apurohit.in
BAN USER
- 1of 1 vote
AnswersPrint all subset of a given set which sums up to ZERO
- apurohit.in in India
{8,3,5,1,-4,-8}
so ans will be : {8,-8}
{3,5,-8}
{3,1,-4}
size of set can be upto 50 but elemet of set can be as big as 18 digit number| Report Duplicate | Flag | PURGE
Amazon Dev Lead Dev Lead Algorithm - 0of 0 votes
AnswersHi ,
- apurohit.in in India
Given a set of number eg {5,3,1,8, -8,-4}
Print all subset which will sum up to ZERO
for eg {3,1,-4} {5,3,-8}, {8,-8}
Note : size of subset can be max 100 and element can be very big like 13 or 14 digit number| Report Duplicate | Flag | PURGE
Amazon Dev Lead Dev Lead Algorithm
0 Answers Maximum number in array after M operations
Given an array numbered from 1 to N, you need to perform M operations. Each operation is described by 3 values a, b and k. Now, k is added for the range of values starting from index 'a' and ending at index 'b' in the given array. Now, After M operations, you have to calculate the maximum of the values in the array.
- apurohit.in January 19, 2016
Initialize the array to '0' before starting to perform M operations.
Consider the number of elements (N) = 5
Number of operations to perform (M) = 4
When M=1,
a=1, b=2, k=100
When M=2,
a=2, b=5, k=100
When M=3,
a=3, b=4, k=100
Initially the array is 0 0 0 0 0
First operation 100 100 0 0 0
Second operation 100 200 100 100 100
Third operation 100 200 200 200 100
ANS 200| Flag | PURGE
Repgladyskcombs, Personnel at Green Bricks
Hello, I am Gladys. I am a Industrial Photographer. I started off my photographic career as a News photographer based ...