Hi, There!
안녕하세요, 바오밥입니다.
목차
- 문제
- 풀이
문제
문제 내용
https://school.programmers.co.kr/learn/courses/30/lessons/120894
풀이
나의 풀이
class Solution {
public long solution(String numbers) {
numbers = numbers
.replaceAll("zero", "0")
.replaceAll("one", "1")
.replaceAll("two", "2")
.replaceAll("three", "3")
.replaceAll("four", "4")
.replaceAll("five", "5")
.replaceAll("six", "6")
.replaceAll("seven", "7")
.replaceAll("eight", "8")
.replaceAll("nine", "9");
return Long.valueOf(numbers);
}
}
'Dev > PS' 카테고리의 다른 글
[프로그래머스-코딩테스트 입문] 한 번만 등장한 문자 (0) | 2023.08.16 |
---|---|
[프로그래머스-코딩테스트 입문] 인덱스 바꾸기 (0) | 2023.08.16 |
[프로그래머스-연습문제] 문자열 내 p와 y의 개수 (0) | 2023.08.16 |
[프로그래머스-연습문제] 문자열을 정수로 바꾸기 (0) | 2023.08.16 |
[프로그래머스-연습문제] 정수 제곱근 판별 (0) | 2023.08.16 |