We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
selectig the smallest top of stack from a, and b doesn't always guarantee the maxmum number of selections. I know this seems counter-intuitive but consider the following example:
maxSum = 10
a = [5, 6]
b = [6, 4]
The correct answer is 2 selections (b[0] + b[1] = 6 + 4 = 10). But you code will produce only 1 selection (a[0] = 5).
Game of Two Stacks
You are viewing a single comment's thread. Return to all comments →
selectig the smallest top of stack from a, and b doesn't always guarantee the maxmum number of selections. I know this seems counter-intuitive but consider the following example: maxSum = 10 a = [5, 6] b = [6, 4]
The correct answer is 2 selections (b[0] + b[1] = 6 + 4 = 10). But you code will produce only 1 selection (a[0] = 5).
Nice one