Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

1.write a proram to find the sum of series
a)S=1+x+x^2+x^3......................+x^n
b)1^2+2^2+3^2..............+n^2
c)2/9-5/13+8/17..................
2.to print fibonacci series.
write a program to find the sum in the following series
a)x-x^2/2!+x^3/3!-x^4/4!...............................x^n/n!
b)x+x^2/2+x^3/3.......+x^n/n
Rahul is a newbie to the programming and while learning the programming language he came to know the following rules:
 · Each program must start with '{' and end with '}'.

 · Each program must contain only one main function. Main function must start with '<' and end with '>'.

 · A program may or may not contain user defined function(s). There is no limitation on the number of user defined functions in the program. User defined function must start with '(' and end with ')'.

 · Loops are allowed only inside the functions (this function can be either main function or user defined function(s)). Every loop must start with '{' and end with '}'.

 · User defined function(s) are not allowed to be defined inside main function or other user defined function(s).

 · Nested loops are allowed.

 · Instructions can be any where inside the program.

 · Number of user defined functions inside a program must not be more than 100.

If any of the
Alia is appearing for the board exams. In order to qualify for the next class Alia need to get exactly X credits. In current semester Alia has to study N number of subjects, and every subject contains C credits. Upon deliberation, Alia has decided that it's better to concentrate on some subjects instead of all. Now Alia is seeking your help to let her know the number of options available for her, such that choosing any one option will promote her to the next standard.
Input Specification:

First line starts with T, number of test cases. Each test case contains N and X, and then next line contains N spaced integers each represent credit (C) associated with i-th subject.

Output Format:

Print the total number of ways available for Alia to qualify for next standard.

Constraints:
1<=T<=10

1<=N<=20

1<=C<=30

1<=X<=500


Sample Input and Output

SNo. Input Output
1
2
5 15
1 2 3 4 5
20 30
30 25 21 25 20 12 19 15 10 28 25 17 21 28 18 27 19 24 21 24



1
3
A rat is in a square maze of dimension N (1-index based). Maze contains 3 types of cells namely: holes (H), pipes (P) and special (S). If the current cell is of type holes, then rat can move to the other adjacent cell which is of type holes only. Same holds true for cells of type pipes and special. Besides this, special cell also has one more property i.e. if the current cell is of type special, then rat can also move to other adjacent cells of type holes and pipes. Simply put, a special cell can connect two cells of type holes and pipes. In the maze every cell contains a cheese of weight Wij and some cells are marked as walls (W). In case, if adjacent cell is of type wall then rat can't move to the adjacent cell.

The rat will start at (1, 1) and it has to reach cell (N, N), it is allowed to move only down or right, and it has to eat the maximum of the available cheese. Your task is to find out the maximum cheese that rat can eat in the journey from (1, 1) to (N, N). In case, if rat can't able to reach (N,
There are N nodes in a graph. The graph is unidirectional with M edges. Of these N nodes in the graph, there are K nodes which are important nodes. Given initial position I, within this graph, the task is to find out, if all K nodes are reachable without travelling a distance greater than V from I.

Input Format:

Input consists of:
First line starts with N, M, I, K and V
Next M lines follow; each contains (Source, Destination, and Distance).
Next line contains K spaced important nodes

Output Format:

Print "Yes" if all K nodes are reachable without travelling a distance greater than V else print "No"

Constraints:
1<=N<=350

1<=M<=N*(N-1)

1<=K<=N

1<=I<=N

0<=V<=500

1<=Source<=N

1<=Destination<=N

1<=Distance<=200


Sample Input and Output

SNo. Input Output
1
3 3 1 2 10
1 2 5
2 3 5
1 3 12
2 3


Yes



Explanation:

Locations 2 is directly reachable through an edge of weight (distance) 5 units.

Node 3 is reachable through edges 1-> 2 and 2-> 3 of weights 5 units each.

Hence node 3 is reachable fr
A string is said to be "Beautiful", if it contains only non repetitive alphabets. Let S be the string with lower case alphabets, your task is to find out the longest "Beautiful sub-string" present in the given string S.

Input Format:

First line starts with T, which is the number of test cases. Each test case contains string S.

Output Format:

Print the first longest beautiful sub string present in the string S.

Constraints:
1<=T<=10

1<=|S|<=5500, S will contain only lower case alphabets.


Sample Input and Output

SNo. Input Output
1
2
ss
abcdeddd


s
abcde
A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindromes with minimum number of character replacements.

Input Format:

First line starts with T, which is the number of test cases. Each test case contains a string (S).

Output Format:

For each test case print the minimum number of character replacements needed to convert the given string to palindrome.

Constraints:
1<=T<=100

1<=|S|<=60, S will contains only lower case alphabets ('a'-'z')


Sample Input and Output

SNo. Input Output
1
2
saarj
saaaa


2
1



Explanation:

For case 1, among many possibilities one is to replace 4-th character with 'a' and replace last character with 's'.

For case 2, among many possibilities one is to replace first character with 'a' to make it a palindrome.
Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Necklaces require polishing the jewels. Operationally, all jewels of the same colour can be polished in one sitting.

Damjibhai and Shamjibhai are two jeweler friends. They decide to play a simple game. The game comprises of removing the jewels for polishing, turn by turn. Once a jewel is removed from the necklace, all other jewels of the same colour are assumed to be removed for polishing from the necklace. The player who polished the most jewels, wins. Damjibhai being more senior, always gets a chance to play first (remove jewel from necklace first). If both players play optimally, find out if Damjibhai can win. The following are the rules of their game
Jewels can only be removed for polishing from either end of the necklace (i.e. head or tail)
Once a jewel type is removed from the necklace, all other instances of the same jewel typ
LATEST TUTORIALS
APPROVED BY CLIENTS