
😎풀이
- 개미의 움직임 탐색
1-1. 이동한 거리를 모두 누적
1-2. 원점(0)으로 돌아온 경우 카운트
- 개미가 원점으로 돌아온 횟수 반환
function returnToBoundaryCount(nums: number[]): number {
let curPos = 0
let boundaryCount = 0
for(const move of nums) {
curPos += move
if(curPos === 0) boundaryCount++
}
return boundaryCount
};