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.
The trickiest part of this problem is that one must use the "rolling sum" trick to obtain an O(N) solution that meets the runtime requirements. Here's a relatively simple Python solution:
Sherlock and Probability
You are viewing a single comment's thread. Return to all comments →
The trickiest part of this problem is that one must use the "rolling sum" trick to obtain an O(N) solution that meets the runtime requirements. Here's a relatively simple Python solution: