File tree Expand file tree Collapse file tree
프로그래머스/1/12925. 문자열을 정수로 바꾸기 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # [ level 1] 문자열을 정수로 바꾸기 - 12925
2+
3+ [ 문제 링크] ( https://school.programmers.co.kr/learn/courses/30/lessons/12925 )
4+
5+ ### 성능 요약
6+
7+ 메모리: 73.5 MB, 시간: 0.02 ms
8+
9+ ### 구분
10+
11+ 코딩테스트 연습 > 연습문제
12+
13+ ### 채점결과
14+
15+ 정확성: 100.0<br />합계: 100.0 / 100.0
16+
17+ ### 제출 일자
18+
19+ 2026년 07월 15일 08:32:51
20+
21+ ### 문제 설명
22+
23+ <p >문자열 s를 숫자로 변환한 결과를 반환하는 함수, solution을 완성하세요.</p >
24+
25+ <h5 >제한 조건</h5 >
26+
27+ <ul >
28+ <li >s의 길이는 1 이상 5이하입니다.</li >
29+ <li >s의 맨앞에는 부호(+, -)가 올 수 있습니다.</li >
30+ <li >s는 부호와 숫자로만 이루어져있습니다.</li >
31+ <li >s는 "0"으로 시작하지 않습니다.</li >
32+ </ul >
33+
34+ <h5 >입출력 예</h5 >
35+
36+ <p >예를들어 str이 "1234"이면 1234를 반환하고, "-1234"이면 -1234를 반환하면 됩니다.<br >
37+ str은 부호(+,-)와 숫자로만 구성되어 있고, 잘못된 값이 입력되는 경우는 없습니다.</p >
38+
39+
40+ > 출처: 프로그래머스 코딩 테스트 연습, https://school.programmers.co.kr/learn/challenges
Original file line number Diff line number Diff line change 1+ class Solution {
2+ public int solution (String s ) {
3+ int answer = 0 ;
4+
5+ answer = Integer .parseInt (s );
6+
7+ return answer ;
8+ }
9+ }
You can’t perform that action at this time.
0 commit comments