Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- 구현
- Counting
- 코딩테스트
- simulation
- Matrix
- bit manipulation
- database
- string
- 자바
- dynamic programming
- SQL
- Tree
- hash table
- Class
- Binary Search
- sorting
- array
- 코테
- java
- Binary Tree
- greedy
- Data Structure
- Number Theory
- implement
- 파이썬
- two pointers
- Method
- Stack
- Math
- geometry
Archives
- Today
- Total
코린이의 소소한 공부노트
[프로그래머스/Lv.0] 숨어있는 숫자의 덧셈 (1) 본문
1. Input
1) 문자열 my_string
2. Output
1) my_string안의 모든 자연수들의 합
3. Constraint
1) 1 ≤ my_string의 길이 ≤ 1,000
2) my_string은 영어 소문자, 대문자 그리고 한자리 자연수로만 구성되어있다.
4. Example
Input: my_string="aAb1B2cC34oOp" -> Output: 10
설명: 1+2+3+4=10
5. Code
1) 첫 코드(2022/10/27)
int answer = 0;
char[] nums = my_string.replaceAll("[a-zA-Z]","").toCharArray();
for(int i=0 ; i<nums.length ; i++)
answer += nums[i] - '0';
return answer;
'코딩테스트 풀이 > JAVA' 카테고리의 다른 글
[프로그래머스/Lv.0] 배열 원소의 길이 (0) | 2022.10.28 |
---|---|
[프로그래머스/Lv.0] 소인수분해 (0) | 2022.10.27 |
[프로그래머스/Lv.0] 문자열 정렬하기 (1) (0) | 2022.10.27 |
[프로그래머스/Lv.0] 모음 제거 (0) | 2022.10.27 |
[프로그래머스/Lv.0] 팩토리얼 (0) | 2022.10.26 |