Skip to main content

Arrays and strings

Two Pointers​

Sliding Window​

Template

def fn(arr):
left = ans = curr = 0

for right in range(len(arr)):
# do logic here to add arr[right] to curr

while WINDOW_CONDITION_BROKEN:
# remove arr[left] from curr
left += 1

# update ans

return ans

Prefix Sum​

Permutations​

Combinations​