-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
algorithm_study/minwoo.lee_java/src/BOJ2015.java
Lines 20 to 31 in f9bedaf
| int[] prefixSum = new int[n + 1]; | |
| prefixSum[0] = 0; | |
| for (int i = 1; i <= n; i++) { | |
| prefixSum[i] = prefixSum[i - 1] + nums[i]; | |
| } | |
| numSums.put(0, 1); | |
| for (int i = 1; i <= n; i++) { | |
| result += (long) numSums.getOrDefault(prefixSum[i] - k, 0); | |
| int temp = numSums.getOrDefault(prefixSum[i], 0) + 1; | |
| numSums.put(prefixSum[i], temp); | |
| } |
26번 라인의
numSums.put(0, 1);
을 논리적으로 설명해주세요
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels