487. Max Consecutive Ones II

Given a binary array nums, return the maximum number of consecutive 1‘s in the array if you can flip at most one 0. Example 1: Input: nums = [1,0,1,1,0] Output: 4 Explanation: – If we flip the first zero, nums becomes [1,1,1,1,0] and we have 4 consecutive ones. – If we flip the second zero, […]

Read More

3. Longest Substring Without Repeating Characters

Given a string s, find the length of the longest substring without repeating characters. Example 1: Input: s = “abcabcbb” Output: 3 Explanation: The answer is “abc”, with the length of 3. Example 2: Input: s = “bbbbb” Output: 1 Explanation: The answer is “b”, with the length of 1. Example 3: Input: s = […]

Read More