Skip to content

Commit a34609d

Browse files
authored
Create Ant on the Boundary.java
1 parent 0e0fd4f commit a34609d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Easy/Ant on the Boundary.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution {
2+
public int returnToBoundaryCount(int[] nums) {
3+
int currPosition = 0;
4+
int count = 0;
5+
for (int num : nums) {
6+
currPosition += num;
7+
if (currPosition == 0) {
8+
count++;
9+
}
10+
}
11+
return count;
12+
}
13+
}

0 commit comments

Comments
 (0)