All Questions
2 questions
0
votes
1
answer
91
views
How to optimize this code: Leetcode input was unexpectedly ( Memory Limit Exceeded )
Leetcode question: Given a binary array nums, return the maximum length of a contiguous subarray with an equal number of 0 and 1.
Leetcode entered a very long input of to the function and its IDE ...
1
vote
1
answer
435
views
Many Subarray Sum Queries
Subarray problem: Given integer array A (only positive numbers), is there a continuous subarray of any length with sum S? Sliding window solution to this is O(N).
Now if we have many such queries S ...