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.
Why does this work? In the case you have the list of squares [1,1, 3, 3, 2], m = 2 and d = 3, there are two positive cases of [2,1] and [1,2]. However, your code gives returns 0.
The only way this makes sense is the assumption the pieces must be consecutive to sum, but I didn't see that mentioned in the problem.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Subarray Division
You are viewing a single comment's thread. Return to all comments →
Why does this work? In the case you have the list of squares [1,1, 3, 3, 2], m = 2 and d = 3, there are two positive cases of [2,1] and [1,2]. However, your code gives returns 0.
The only way this makes sense is the assumption the pieces must be consecutive to sum, but I didn't see that mentioned in the problem.