본문 바로가기

Coding Test/프로그래머스

(138)
[프로그래머스/자바] 세균 증식 class Solution { public int solution(int n, int t) { return n * (int) Math.pow(2, t); } }
[프로그래머스/자바] 옷가게 할인받기 class Solution { public int solution(int price) { if(price >= 500000) { return (int) (price * 0.8); } else if(price >= 300000) { return (int) (price * 0.9); } else if(price >= 100000) { return (int) (price * 0.95); } else { return price; } } } class Solution { public int solution(int price) { int answer = 0; if(price>=500000) return (int)(price*0.8); if(price>=300000) return (int)(price*0.9); if..
[프로그래머스/자바] 부분 문자열인지 확인하기 class Solution { public int solution(String my_string, String target) { return my_string.contains(target) ? 1 : 0; } }
[프로그래머스/자바] 기능개발 import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Queue; class Solution { public int[] solution(int[] progresses, int[] speeds) { Queue queue = new LinkedList(); for(int i=0; i= queue.peek()) { queue.poll(); count++; } list.add(count); } int[] result = new int[list.size()]; for(int i=0; i
[프로그래머스/자바] 문자 반복 출력하기 class Solution { public String solution(String my_string, int n) { String answer = ""; for(int i=0; i
[프로그래머스/자바] 순서쌍의 개수 class Solution { public int solution(int n) { int answer = 0; for(int i=1; i
[프로그래머스/자바] 정수 찾기 class Solution { public int solution(int[] num_list, int n) { for(int i : num_list) { if(i == n) return 1; } return 0; } }
[프로그래머스/자바] flag에 따라 다른 값 반환하기 class Solution { public int solution(int a, int b, boolean flag) { return flag == true ? (a + b) : (a - b); } }