I got
1.There is a table tennis games between A and B. There score board is marked in X-Y format where X is the score of A and Y is the score of B. In beginning A severs and after 2 servers it is pass to the other person. Find the number of times A servered
Inputs given
t=4
So here t mentioned is number of elements in array
0
0
1
0
Here 0-0 is the score of first game and A is served here
Then 1-0 is the score of next game here also A is served
Total A served are 2
t=4
2
0
5
0
Here 2-0 B is served
And 5-0 A is served
So here total A served is 1
2)1.You are given an array A consisting of n integers. Your task is to construct a new array B with non negative integers and length less than 2^25 such that
The XOR of all elements in A and that of elements of B are same.
Find the sum of elements in B and return the result modulo 10^9 +7.
Inputs given
n=1
[5]
Output is 5
3) There is an array given we need find the maximum subarray sum. Here we can delete first element and append it to the end of array and find maximum subarray sum
Input given
[1,3,-4,5,2]
The element on first position can be deleted from front and add to the back
[3,-4,5,2,1]
The next element can also be deleted from front and add to back to get maximum subarray sum
[-4,5,2,1,3]
Sum=11