About 795,000 results
Open links in new tab
  1. Longest Subarray with an Extra 1 - GeeksforGeeks

    Dec 11, 2024 · Given a binary array arr[], the task is to find the length of the longest subarray having count of 1s exactly one more than count of 0s. Examples: Input: arr[] = [0, 1, 1, 0, 0, 1]

  2. 1493. Longest Subarray of 1's After Deleting One Element

    In-depth solution and explanation for LeetCode 1493. Longest Subarray of 1's After Deleting One Element in Python, Java, C++ and more. Intuitions, example walk through, and complexity …

  3. Longest Subarray of 1's After Deleting One Element - LeetCode

    Longest Subarray of 1's After Deleting One Element. Given a binary array nums, you should delete one element from it. Return the size of the longest non-empty subarray containing only …

  4. Master the Longest Subarray Coding Question in Python

    Aug 9, 2023 · This guide covered various methods to find the longest subarray with equal zeros and ones in Python. We looked at a basic O(N^2) solution, an optimized O(N) hashmap-based …

  5. python - Where does my code fail? Longest sequence of alternating 0's ...

    Jan 15, 2025 · The question asks for (apparently the length of) the longest subsequence of alternating 0s and 1s, but your code returns the length of the longest subarray of alternating 0s …

  6. 5 Best Ways to Find the Longest Subarray of 1s After Deleting

    Mar 6, 2024 · Your task is to determine the longest subarray of 1s that can be achieved by removing at most one element from the array. For example, given input [1, 1, 0, 1, 1], the …

  7. Largest Subarray of 0’s and 1’s - InterviewBit

    Nov 11, 2021 · Explanation: [0, 1, 1, 1, 0, 0] is the longest subarray with equal number of 0s and 1s. The most naive approach is to simply generate all possible subarrays of the given array. …

  8. Longest Subarray With Equal Number of 0s and 1s

    Jan 13, 2025 · Given an array arr[] containing only 0s and 1s, find the longest subarray which contains equal no of 0s and 1s. Examples: Input: arr[] = [1, 0, 1, 1, 1, 0, 0] Output: 6 …

  9. Python Longest Contiguous Subarray - CodePal

    Find the length of the longest contiguous subarray in Python that consists of an equal number of 0s and 1s. This code defines a function that takes an input array and returns the length of the …

  10. python - Need explanation on one awesome solution found for …

    Jul 6, 2023 · Longest Subarray of 1's After Deleting One Element: Given a binary array nums, you should delete one element from it. Return the size of the longest non-empty subarray …

Refresh