Tagged as easy, I feel it is not easy to solve. dynamic programming class problem. The solution is others, I only verify it.
Java
1 Kadane’s algorithm
1 | class Solution { |
Submission Detail
- 202 / 202 test cases passed.
- Runtime: 10 ms
- Your runtime beats 40.59 % of java submissions.
2 DP
1 | class Solution { |
Submission Detail
- 202 / 202 test cases passed.
- Runtime: 7 ms
- Your runtime beats 89.29 % of java submissions.
ref
- Maximum subarray problem
- Solving Algorithmic Problems: Maximum Sum of a Contiguous Subarray
Go to the profile of Teiva Harsanyi - LeetCode – Maximum Subarray (Java)
- How do I find the maximum sum contiguous subarray using a divide and conquer method?
- Divide and Conquer – Leetcode problem53. Maximum Subarray