About 1,320,000 results
Open links in new tab
  1. Easy algorithm-Leet code- Maximum sub array - Stack Overflow

    Mar 15, 2022 · Maximum Subarray Easy Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. A …

  2. Algorithm Divide and Conquer Maximum Subarray - Stack Overflow

    (cʹ) A = [30, −50, 20, −5, 40], where the interval with maximum total profit is from month 3 up to month 5 with a total profit equal to 55. Design an efficient divide and conquer algorithm. To …

  3. Maximum sum of contiguous sub-sequence with length at most k

    Apr 1, 2019 · What I want to do is find the maximum subarray with length at most K. Example: We have an array A = [3,-5 1 2,-1 4,-3 1,-2] and we want to find the maximum subarray of length …

  4. find minimum of maximum subarray length with GCD more than 1

    Mar 23, 2025 · Given L, the maximum allowed subarray length, M = L+1, is the minimum disallowed subarray length. All subarrays of length M need to be broken if they have a …

  5. Length of Longest Subarray With A Consistent Frequency

    Jul 7, 2024 · Given an array A, a subarray of A is called "consistent" if the maximum occurrence of all elements in the subarray is equal to the minimum occurrence of all elements in the …

  6. How to find maximum sum subarray of size between [L, R]

    Jul 11, 2020 · For a small array say for size 2 the maximum subarray will be either the left half, or the right half, or the crossing containing both elements for the left half and right half. for eg If …

  7. Maximum subarray sum for Python - Stack Overflow

    Dec 7, 2019 · There is a task on codewars that asks to do the following: The maximum sum subarray problem consists in finding the maximum sum of a contiguous subsequence in an …

  8. c - largest sum contiguous sub array using recursion to directly …

    Jul 10, 2015 · Introduce two global variables, start_idx and end_idx to track the start and end indices of the largest contiguous subarray. Update these variables accordingly in the recursive …

  9. Maximum sum of all subarrays of size k for each k=1..n

    Jun 1, 2015 · Using Divide and Conquer approach, we can find the maximum subarray sum in O(nLogn) time. Following is the Divide and Conquer algorithm. 1) Divide the given array in two …

  10. Why is the maximum sum subarray brute force O (n^2)?

    Jan 28, 2017 · The maximum subarray sum is a famous problem in computer science. There are at least two solutions: Brute force, find all the possible sub arrays and find the maximum. Use …