path
순회true
반환false
반환function isPathCrossing(path: string): boolean {
const history = new Set()
let x = 0
let y = 0
history.add(`${x},${y}`)
for(const direct of path) {
switch(direct) {
case 'E':
x++
break
case 'W':
x--
break
case 'S':
y++
break
case 'N':
y--
break
default:
break
}
const curPos = `${x},${y}`
if(history.has(curPos)) return true
history.add(curPos)
}
return false
};