Questions: 11 448

Answers by our Experts: 10 707

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

Given two strings x and y, find the longest common subsequence and its length.

Sample Input 1:

x = “ABCBDAB”

y = “BDCABA”

Sample output 1:

longest common subsequence = “BCBA”

longest common subsequence length = 4 

Sample Input 2:

x = “ABBACQ”

y = “XAYZMBNNALQCTRQ”

Sample output 2:

longest common subsequence = “ABACQ”

longest common subsequence length = 5


You’re given n boxes of chocolates arranged sequentially. Each box contains ai chocolates. You have to pick the maximum number of chocolates from the boxes and you must follow the given rule: ● You cannot pick chocolates from two consecutive boxes Let me explain the rule. If you pick chocolates from the ith box, you are not allowed to pick chocolates from the i+1th box or i-1 th box. The first line of the input represents n (2<=n<=1000), the number of boxes, and the following line represents the number of chocolate of those n boxes. Print the maximum number of chocolates you can collect from the boxes with satisfying the condition. 

Sample Input :

8

1 2 3 4 5 6 7 8

Sample Output: 20

Sample Input 3:

5

2 50 100 75 1

Sample Output:

125


There are two trucks on the roads and you have n boxes. You want to carry all of the boxes from Dhaka to Sylhet using these two trucks. Remember, you must use these two trucks together. You know the weight of each box. One of the truck drivers is very lazy to start the truck so that he hit upon a plan. He said to you, “If the load of two trucks is not equal, then they will not start the trucks”. Can you please figure out whether it is possible to bring those n boxes to Sylhet using those two trucks? The first line of the input represents n (2<=n<=1000), the number of boxes, and the following line represents the weight of those n boxes. The maximum weight of each box can be 100. Print YES if it is possible to divide the boxes in such a way that the load of two trucks is equal, otherwise print NO.

Sample Input 1:

5 2 3 6 2 1

Sample Output 1:

YES

Sample Input 3:

4 2 4 2 2

Sample Output 3:

NO



I have an array of 3 numbers here with me that's already in the code editor, but I want you to add some more to this list by inputting some more numbers yourself in one line and then, print out only the even numbers from the array.


Can you do that for me?


Input

The first line contains the number of elements, n, to be added.

The next line contains the n integers separated by a space.

5
33·54·32·11·8

Output

Multiple lines containing an integer.

2
54
32
8

Make me a program that accepts two random strings. Then, count the number of vowels that are in each of the strings and put it on separate variables.


Finally, for the survival of the vowels, subtract the total count of vowels of the first string to the vowels of the second string then print out its difference.


Easy, right? Then go and code as if your life depends on it!


Input

Two lines containing a string on each.

C++·is·fuN
CodeChum·is·AWEsome

Output

A line containing an integer.

6




Make a program that will accept an integer and loop for the same number of times as that of the inputted integer and input random integers and add it to the array/list one by one, per line. Afterwards, make your program accept another random integer.


Using that final integer, compare from your array/list if the final integer's value is also present in your current array/list. If so, print "Present"; otherwise, print "None".


Start coding now!


Input

The first line contains the size of the array.

The next lines contain the integers.

The last line contains an integer to be searched.

5
3
21
2
5
23
2

Output

A line containing a string.

Present




Define a class License that has a driving license number, name and address. Define



constructors that take on parameter that is just the number and another where all



parameters are present.



Define a class License that has a driving license number, name and address. Define constructors that take on parameter that is just the number and another where all parameters are present.


Write a C++ program which contains a function of bool type and takes an argument of integer type value. The argument is taken from user in main function and calls the bool function. The bool type function will check whether the argument number is a prime number or not. The result will be send back to main function and displays the status of the number


Suppose you are playing a killing game and have to kill few of your enemies. You are at a

cliff and from there you can see few of them. You see the enemies at your height only.

Therefore, you can only kill at the same height. The enemies are forming a balanced binary

tree where their General is at the top of the other cliff, his two commanders are on the first

level below him. The soldiers are at the lowest level. Total four soldiers are appointed. Under

both the commanders exact two soldiers serve.

You have to make a strategy to kill the left commander first, than whoever takes his position

kill him. Now start killing the right side with same strategy until only one enemy is left at left

side. Now increase your height and kill the General. You can only win if only three of your

enemies are left.

Display the enemies who are left and who have been killed. Don’t forget to print your victory

message.

LATEST TUTORIALS
APPROVED BY CLIENTS