목록코딩테스트 풀어보기 (4)
개발이 하고싶니?
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ArrayList inPut = new ArrayList(); while(true){ String inputLine = br.readLine(); inPut.add(inputLine); if (inputLine.equals("=")){ break; } } int[] num = new int[inPut.size()/2]; String[] sign = new String..
class Solution { public int solution(String str1, String str2) { int size = str2.length(); int answer=0; for(int i=0; i
import java.util.*; class Solution { public int[] solution(int[] numbers, String direction) { Deque answer = new ArrayDeque(); for( int i : numbers){ answer.addLast(i); } if(direction.equals("right")){ answer.addFirst(answer.peekLast()); answer.pollLast(); } else if(direction.equals("left")){ answer.addLast(answer.peekFirst()); answer.pollFirst(); } return answer.stream().mapToInt(Integer::intVa..