Algorithm/Practice
2020. 4. 11.
프로그래머스 - 스택, 큐_탑 (JAVA)
탑 높이가 중복되는 것이 없다고 가정하고 풀어서, 테스트 케이스 반만 통과되었다. 탐색하면서 스택에 넣고, 나중에 출력했다. import java.util.*; class Solution { public int[] solution(int[] heights) { int flag; Stack s=new Stack(); for(int i=heights.length-1;i>=0;i--){ flag=i; for(int j=i;j>=0;j--){ System.out.println(heights[i]+"-"+heights[j]); if(heights[i]