Hi Guys,
While I was going through past google questions from leetcode discuss, below are some of the repeating questions I found.
- An stone array is given.
A mouse is on index 0 initially, he starts jumping towards right.
Score of a jump is = (len of jump * value of stone mouse is jumping on to)
for eg : Score of jump from i to j, score would be = (j-i)*stone[j]
Mouse can make any number of jumps, find what is the maximum score that can be achieved.
ex
3 5 4 7 2 12 8 10 1
ex: 3 to 12 (512) + 12 to 10 (210) + 10 to 1 (1*1) = 81
Expected TC - O(n)
- (newly added)
A bank has some initial amount, and an array of customer to serve. Its a linear array. Customer can deposit money (-ve int value) or withdraw (+ve int value).
Bank can start from any index to start serving. But if started, can’t skip any customer from that index. Find maximum how many customer can be served.
Example1 :
Bank has 1 unit of money initially.
Customer transactions : [1, -3, 5, -2, 1]
answer = 3
Example2 :
Bank has 4 unit of money initially.
Customer transactions : [3,1,1,1,1]
answer = 4
Expected TC - O(n)
I will be adding more questions in the future. Would request you to add questions in the comments, if you find them repeating. I will add those in this blog!
Comments (34)

