테스트 케이스 8번만 틀린걸로 나왔는데 어디서 틀린건지 모르겠어서요 혹시 힌트만 주시거나 테스트 케이스 한개만 주실수 있으신가요?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 def solution(keyinput, board): x = board[0] // 2 y = board[1] // 2 xcount = 0 ycount = 0 a = 0 b = 0 for i in keyinput: if i == "up" and abs(ycount) < y: b += 1 ycount += 1 elif i == "down" and abs(ycount) < y: b -= 1 ycount -= 1 elif i == "left" and abs(xcount) < x: a -= 1 xcount -= 1 elif i == "right" and abs(xcount) < x: a += 1 xcount += 1 return [a, b]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
def solution(keyinput, board): x = board[0] // 2 y = board[1] // 2 xcount = 0 ycount = 0 a = 0 b = 0 for i in keyinput: if i == "up" and abs(ycount) < y: b += 1 ycount += 1 elif i == "down" and abs(ycount) < y: b -= 1 ycount -= 1 elif i == "left" and abs(xcount) < x: a -= 1 xcount -= 1 elif i == "right" and abs(xcount) < x: a += 1 xcount += 1 return [a, b]
반례입니다. 입력값 〉 ["right", "right", "right", "right", "right", "left"], [9, 5] 기댓값 〉 [3, 0]