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.
You do not even need to store the whole sum while reading the elements from console into array you can calculate the sum of all elements of one stack. Then simply reduce the current element from sum to get total sum at one level lower. This is what I did but my submission is failing for two testcases : 3 and 23. If anyone can then please share these testcases
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Equal Stacks
You are viewing a single comment's thread. Return to all comments →
You do not even need to store the whole sum while reading the elements from console into array you can calculate the sum of all elements of one stack. Then simply reduce the current element from sum to get total sum at one level lower. This is what I did but my submission is failing for two testcases : 3 and 23. If anyone can then please share these testcases