Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5285f48

Browse files
committed
增加No560
1 parent 87a46e1 commit 5285f48

File tree

2 files changed

+56
-22
lines changed

2 files changed

+56
-22
lines changed

.idea/workspace.xml

Lines changed: 37 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

leetcode/Array/No560.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @author tujietg
3+
* @date 5/15/20 10:59 AM
4+
*/
5+
public class No560 {
6+
public int subarraySum(int[] nums, int k) {
7+
int count = 0;
8+
for (int start = 0; start < nums.length; start++) {
9+
int sum = 0;
10+
for (int end = start; end >= 0; end--) {
11+
sum += nums[end];
12+
if (sum == k) {
13+
count++;
14+
}
15+
}
16+
}
17+
return count;
18+
}
19+
}

0 commit comments

Comments
 (0)