We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a9e84ff commit 6d6f012Copy full SHA for 6d6f012
README.md
@@ -167,8 +167,8 @@
167
- [删除并获得点数](./solution/0700-0799/0740.Delete%20and%20Earn/README.md)
168
- [跳跃游戏](./solution/0000-0099/0055.Jump%20Game/README.md)
169
- [跳跃游戏 II](./solution/0000-0099/0045.Jump%20Game%20II/README.md)
170
-- [接雨水](./solution/0000-0099/0042.Trapping%20Rain%20Water/README.md)
171
- [最大子序和](./solution/0000-0099/0053.Maximum%20Subarray/README.md)
+- [接雨水](./solution/0000-0099/0042.Trapping%20Rain%20Water/README.md)
172
- [礼物的最大价值](./lcof/面试题47.%20礼物的最大价值/README.md)
173
- [最小路径和](./solution/0000-0099/0064.Minimum%20Path%20Sum/README.md)
174
- [解码方法](./solution/0000-0099/0091.Decode%20Ways/README.md)
README_EN.md
@@ -161,8 +161,8 @@ Complete solutions to [LeetCode](https://leetcode.com/problemset/all/), [LCOF](h
161
- [Delete and Earn](./solution/0700-0799/0740.Delete%20and%20Earn/README_EN.md)
162
- [Jump Game](./solution/0000-0099/0055.Jump%20Game/README_EN.md)
163
- [Jump Game II](./solution/0000-0099/0045.Jump%20Game%20II/README_EN.md)
164
-- [Trapping Rain Water](./solution/0000-0099/0042.Trapping%20Rain%20Water/README_EN.md)
165
- [Maximum Subarray](./solution/0000-0099/0053.Maximum%20Subarray/README_EN.md)
+- [Trapping Rain Water](./solution/0000-0099/0042.Trapping%20Rain%20Water/README_EN.md)
166
- [Minimum Path Sum](./solution/0000-0099/0064.Minimum%20Path%20Sum/README_EN.md)
- [Decode Ways](./solution/0000-0099/0091.Decode%20Ways/README_EN.md)
- [Maximum Product Subarray](./solution/0100-0199/0152.Maximum%20Product%20Subarray/README_EN.md)
solution/0000-0099/0053.Maximum Subarray/README.md
@@ -77,10 +77,9 @@
77
```python
78
class Solution:
79
def maxSubArray(self, nums: List[int]) -> int:
80
- n = len(nums)
81
res = f = nums[0]
82
- for i in range(1, n):
83
- f = nums[i] + max(f, 0)
+ for num in nums[1:]:
+ f = num + max(f, 0)
84
res = max(res, f)
85
return res
86
```
@@ -155,6 +154,22 @@ func maxSubArray(nums []int) int {
155
154
}
156
157
+### **C#**
158
+
159
+```cs
160
+public class Solution {
+ public int MaxSubArray(int[] nums) {
+ int res = nums[0], f = nums[0];
+ for (int i = 1; i < nums.Length; ++i)
+ {
+ f = nums[i] + Math.Max(f, 0);
+ res = Math.Max(res, f);
+ }
+ return res;
+}
+```
### **...**
175
solution/0000-0099/0053.Maximum Subarray/README_EN.md
@@ -49,10 +49,9 @@
49
50
51
52
53
54
55
56
57
58
@@ -125,6 +124,22 @@ func maxSubArray(nums []int) int {
125
124
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
solution/0000-0099/0053.Maximum Subarray/Solution.cs
@@ -0,0 +1,11 @@
1
2
3
4
5
6
7
8
9
10
11
solution/0000-0099/0053.Maximum Subarray/Solution.py
@@ -1,8 +1,7 @@
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments