https://school.programmers.co.kr/learn/courses/30/lessons/12948 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr https://howtodoinjava.com/java/string/get-last-4-characters/ Get Last 4 Chars of a String in Java - HowToDoInJava Learn how to get last 4 characters of a String or simply any number of last characters of a string in Java us..
https://school.programmers.co.kr/learn/courses/30/lessons/12947 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr - 10으로 나눈 나머지를 활용, 모든 자릿수를 합한 후 그걸로 나눈 나머지가 0인지 판별 class Solution { public boolean solution(int x) { int numbers=0, temp=x; while(temp>0){ numbers+=temp%10; temp/=10; } return (x%numbers==0)?true: false; } }
https://school.programmers.co.kr/learn/courses/30/lessons/12969 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr- 이중 반복문 사용class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); for(int i=0;i
https://school.programmers.co.kr/learn/courses/30/lessons/12954 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr -x의 배수를 x*n까지 출력한다고 생각하면 됨 -반복문 사용 -숫자가 커질 때를 고려해서, x의 데이터타입을 일시적으로 long으로 변환해주기! class Solution { public long[] solution(int x, int n) { long[] answer = new long[n]; for(int i=1; i
https://school.programmers.co.kr/learn/courses/30/lessons/12934 class Solution { public long solution(long n) { long k=(long)Math.sqrt(n); if (n==k*k) return (k+1)*(k+1); else return -1; } }
https://school.programmers.co.kr/learn/courses/30/lessons/133499#qna class Solution { public int solution(String[] babbling) { int answer = 0; String[] words = {"aya", "ye", "woo", "ma"}; for(int i=0;i0) { cycle = true; //일치하는 게 없이 한 사이클 다 돌았는지 체크 for (int idx = 0; idx < 4; idx++) { if (babbling[i].startsWith(words[idx])) { cycle = false; babbling[i] = babbling[i].replaceFirst(words[idx], ""); t..
https://school.programmers.co.kr/learn/courses/30/lessons/42578 import java.util.*; class Solution { public int solution(String[][] clothes) { int answer = 1; Map closet = new HashMap(); for(int i=0;i
https://school.programmers.co.kr/learn/courses/30/lessons/92341 import java.util.*; class Solution { Map carSumTime = new TreeMap(); //누적 시간 Map carIn = new HashMap(); //입차 시간 public void calTime(int carNum, String carOut){ String[] inTime = carIn.get(carNum).split(":"); String[] outTime = carOut.split(":"); int time = (Integer.parseInt(outTime[0])-Integer.parseInt(inTime[0]))*60 +Integer.parseI..
https://school.programmers.co.kr/learn/courses/30/lessons/12924?language=java class Solution { public int solution(int n) { int answer = 1; for(int i=1;i