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
- database
- SQL
- Counting
- Binary Search
- geometry
- 코테
- sorting
- simulation
- Matrix
- Binary Tree
- greedy
- 구현
- implement
- string
- two pointers
- Method
- Class
- 파이썬
- java
- hash table
- Math
- Stack
- Tree
- Number Theory
- Data Structure
- dynamic programming
- array
- bit manipulation
- 코딩테스트
- 자바
Archives
- Today
- Total
코린이의 소소한 공부노트
[LeetCode/Easy] 1929. Concatenation of Array 본문
1. Input
1) 정수 배열 nums
- nums.length == n
2. Output
1) 다음 규칙대로 만든 배열 ans
- ans[i] == nums[i]
- ans[i + n] == nums[i]
3. Constraint
1) 1 <= n <= 1000
2) 1 <= nums[i] <= 1000
4. Example
Input: nums = [1,3,2,1] -> Output: [1,3,2,1,1,3,2,1]
5. Code
1) 첫 코드(2022/06/01)
int[] ans = new int[nums.length*2];
for(int i=0 ; i<nums.length ; i++){
ans[i] = ans[i+nums.length] = nums[i];
}
return ans;
'코딩테스트 풀이 > JAVA' 카테고리의 다른 글
[LeetCode/Easy] 1941. Check if All Characters Have Equal Number of Occurrences (0) | 2023.01.08 |
---|---|
[LeetCode/Easy] 1935. Maximum Number of Words You Can Type (0) | 2023.01.08 |
[LeetCode/Easy] 1920. Build Array from Permutation (0) | 2023.01.07 |
[LeetCode/Easy] 1913. Maximum Product Difference Between Two Pairs (0) | 2023.01.07 |
[LeetCode/Easy] 1903. Largest Odd Number in String (0) | 2023.01.07 |