Google Interview Question for Software Engineers
- 1of 1 vote
Given N stacks, each stack contains Si elements, find the maximum sum of the M numbers in the N stacks. To get the number of the stack, only supporting get the top number. For example, S=[1,200,1,2,3], if you want to get the number 200, you need choose 3,2,1 first.- jeffrey November 28, 2016 in United States
the maximum sum of the 3 numbers in the above stacks is 3+100+3=107.
Any better solution for this problem?
| Report Duplicate | Flag | PURGE
Google Software Engineer Dynamic Programming
Open Chat in New Window