Notice
Recent Posts
Recent Comments
Link
목록카카오 (1)
drexqq
[Java, 자바]Programmers - 크레인인형뽑기게임
class Solution { public int solution(int[][] board, int[] moves) { int answer = 0; Stack basket = new Stack(); for (int i = 0; i < moves.length; i++) { for (int j = 0; j < board.length; j++) { if (board[j][moves[i]-1] != 0) { if (basket.isEmpty()) { basket.push(board[j][moves[i]-1]); } else { if (basket.peek() == board[j][moves[i]-1]) { basket.pop(); answer += 2; } else { basket.push(board[j][mo..
공부노트/Programmers
2020. 6. 22. 12:41