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
- SQL
- bit manipulation
- java
- 코테
- 파이썬
- dynamic programming
- Math
- implement
- sorting
- Counting
- 코딩테스트
- Stack
- greedy
- array
- database
- Matrix
- Method
- simulation
- 자바
- Data Structure
- string
- Binary Tree
- Number Theory
- two pointers
- Class
- Binary Search
- Tree
- 구현
- hash table
- geometry
Archives
- Today
- Total
코린이의 소소한 공부노트
[LeetCode/Easy] 344. Reverse String 본문
1. Input
1) 알파벳 1개씩을 담은 문자열 배열 s
2. Output
1) s의 순서를 뒤집은 배열
3. Constraint
1) 1 <= s.length <= 10^5
2) s[i]는 알파벳 대문자 또는 소문자이다.
4. Example
Input: s=s = {"H","a","n","n","a","h"} -> Output: {"h","a","n","n","a","H"}
5. Code
1) 첫 코드(2022/06/16)
if(s.length != 1){
char c;
for(int i=0 ; i<s.length/2 ; i++){
c = s[i];
s[i] = s[s.length-1-i];
s[s.length-1-i] = c;
}
}
return s;
'코딩테스트 풀이 > JAVA' 카테고리의 다른 글
[프로그래머스/Lv.1] 삼총사 (0) | 2022.11.30 |
---|---|
[LeetCode/Easy] 412. Fizz Buzz (0) | 2022.11.29 |
[LeetCode/Easy] 342. Power of Four (0) | 2022.11.29 |
[LeetCode/Easy] 338. Counting Bits (0) | 2022.11.29 |
[LeetCode/Easy] 326. Power of Three (0) | 2022.11.29 |