[프로그래머스] 콜라 문제
Algorithm/프로그래머스2024. 9. 30. 09:54[프로그래머스] 콜라 문제

https://school.programmers.co.kr/learn/courses/30/lessons/132267 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 📌 정답class Solution { public int solution(int a, int b, int n) { int answer = 0; while(n >= a) { answer += (n / a) * b; n = n % a + (n / a) * b; } return answer; ..

[프로그래머스] 숫자 문자열과 영단어
Algorithm/프로그래머스2024. 9. 23. 20:33[프로그래머스] 숫자 문자열과 영단어

https://school.programmers.co.kr/learn/courses/30/lessons/81301?language=java 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr📌 내가 구현한 정답class Solution { public int solution(String s) { String[] numbers = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; String answer = s; for (in..

[프로그래머스] 3진법 뒤집기
Algorithm/프로그래머스2024. 9. 3. 23:57[프로그래머스] 3진법 뒤집기

프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 📌 3진법 뒤집기  📌 내가 구현한 정답class Solution { public int solution(int n) { String answer = Integer.toString(n, 3); // 3진수로 변환 String reversed = new StringBuilder(answer).reverse().toString(); // 문자열 뒤집기 return Integer.parseInt(reversed, 3); // 다시 1..

image