no image
[프로그래머스] 문자열 뒤집기 - java
class Solution { public String solution(String my_string) { String answer = ""; for(int i=my_string.length()-1; i>=0; i--){ answer+=my_string.charAt(i); } return answer; } } 🚒 다른 사람 답 import java.util.*; class Solution { public String solution(String my_string) { StringBuilder sb = new StringBuilder(); sb.append(my_string); sb.reverse(); return sb.toString(); } }
2023.04.07
no image
[프로그래머스] 배열 뒤집기 - JAVA
class Solution { public int[] solution(int[] num_list) { int[] answer = new int[num_list.length]; for(int i = 0;i
2023.04.06
no image
[프로그래머스] 옷 가게 할인 받기 - java
class Solution { public int solution(int price) { int answer = 0; if( price >= 500000) { answer = (int)(price*0.8); } else if( price >= 300000){ answer = (int)(price * 0.9); }else if (price >= 100000){ answer = (int)(price * 0.95); } else { answer = price; } return answer; } } 다른 사람 답 class Solution { public int solution(int price) { int answer = 0; if(price>=500000) return (int)(price*0.8); if(..
2023.04.06
no image
[프로그래머스] 3월에 태어난 여성 회원 목록 출력하기 - MY SQL
SELECT MEMBER_ID, MEMBER_NAME, GENDER, DATE_FORMAT(DATE_OF_BIRTH, '%Y-%m-%d') AS DATE_OF_BIRTH FROM MEMBER_PROFILE WHERE MONTH(DATE_OF_BIRTH) = 3 AND GENDER = 'W' AND TLNO IS NOT NULL ORDER BY MEMBER_ID;
2023.04.03
no image
[프로그래머스] 피자나눠먹기(3) - java
class Solution { public int solution(int slice, int n) { return (int) Math.ceil(n/(slice*1.0)); } }
2023.04.03
no image
[프로그래머스] 피자 나눠 먹기(2)
class Solution { public int solution(int n) { int answer = 0; for (int i = 1; i
2023.04.03
no image
[프로그래머스] 피자 나눠 먹기 (1)
class Solution { public int solution(int n) { int answer = 0; if(n%7 ==0) answer = n/7; else answer = n/7+1; return answer; } }
2023.04.03
no image
[프로그래머스] 폰켓몬 - java
import java.util.HashSet; class Solution { public int solution(int[] nums) { int answer = 0; int max = nums.length / 2; // 중복을 제거하기 위해 해시셋에 넣기 HashSet set = new HashSet(); for(int i : nums) { set.add(i); } // 두 값중 최소값을 리턴 if(set.size() > max) { answer = max; } else { answer = set.size(); } return answer; } }
2023.04.03
no image
[프로그래머스] 각도기 -java
class Solution { public int solution(int angle) { if (angle > 0 && angle 90 && angle < 180) return 3; else return 4; } }
2023.03.30