Medium ✔
- Longest Substring Without Repeating Characters
- 31 March, 2026: 00.04.58 ✔
- Max Consecutive Ones III
- 01 April, 2026: 00.02.44 ✔
- Fruit Into Baskets
- 01 April, 2026: 00.05.35 ✔
- Longest Repeating Character Replacement
- 02 April, 2026: 00.17.45 ❌
- Failed at implementation
- The desire case is longest sequence - maximum frequency should be greater than
k
- The desire case is longest sequence - maximum frequency should be greater than
- Failed at implementation
- 02 April, 2026: 00.17.45 ❌
- Binary Subarrays With Sum
- 31 March, 2026: 00.12.07 ❌
- Failed at edge cases
- Count leading zeros
- Traditional sliding window fail
- Sliding window works best when:
- The window sum behaves monotonically (only increases when expanding, decreases when shrinking)
- You can adjust the window deterministically based on comparison
- When you expand the window:
- Adding
1increases sum - Adding
0does NOT change sum
- Adding
- Method 1: Prefix Sum + HashMap
current_sum - previous_sum = goal - Method 2: Modified Sliding Window
Now define:
exact(goal) = atMost(goal) - atMost(goal - 1)atMost(k)= number of subarrays with sum ≤ k
This works because:- Sliding window can handle ≤ k
- It avoids the “multiple zero ambiguity”
- Failed at edge cases
- 31 March, 2026: 00.12.07 ❌
- Count number of Nice subarrays
- 31 March, 2026: 00.12.07 ❌
- Failed at edge cases
- Count leading even numbers (for subarray start positions)
- Failed at edge cases
- 31 March, 2026: 00.12.07 ❌
- Number of Substrings Containing All Three Characters
- 31 March, 2026: 00.22.54 ❌
- Expand if you don't have the answer
- Shrink if you have the answer
- All substrings starting at left to right are valid
- 31 March, 2026: 00.22.54 ❌
- Maximum Points You Can Obtain from Cards
- 31 March, 2026: 00.34.33 ❌
- Failed at implementation
- In one step, you can take one card from the beginning or from the end of the row.
take k from left, 0 from right
take n-1 from left, 1 from right
take n-2 from left, 2 from right
take k-3 from left, 3 from right - Only the
kth item from the begin and end matter
- In one step, you can take one card from the beginning or from the end of the row.
- Failed at implementation
- 31 March, 2026: 00.34.33 ❌