디시인사이드 갤러리

마이너 갤러리 이슈박스, 최근방문 갤러리

갤러리 본문 영역

989. Add to Array-Form of Integer

이벤트(1.226) 2023.02.15 21:16:05
조회 15 추천 0 댓글 0
														
class Solution {
public List<Integer> addToArrayForm(int[] num, int k) {
List<Integer> ret = new ArrayList<>();
String KString = String.valueOf(k);
int kPointer = KString.length() - 1;
int numPointer = num.length - 1;
int counter = 0;
while(kPointer >= 0 || numPointer >= 0 || counter >= 1)
{
int K = 0;
int n = 0;
if(kPointer >= 0) {
K = KString.charAt(kPointer) - '0';
}
if(numPointer >= 0) {
n = num[numPointer];
}
int current = n + K + counter;
counter = current/10;
ret.add(current%10);
kPointer--;
numPointer--;
}
Collections.reverse(ret);
return ret;
}
}

어제랑 똑같네

추천 비추천

0

고정닉 0

0

댓글 영역

전체 댓글 0
본문 보기

하단 갤러리 리스트 영역

왼쪽 컨텐츠 영역

갤러리 리스트 영역

갤러리 리스트
번호 제목 글쓴이 작성일 조회 추천
설문 2025년 가장 기억에 남는 인터넷 이슈는? 운영자 25/12/22 - -
214 1675. Minimize Deviation in Array 개발뉴비갤로그로 이동합니다. 23.02.25 26 0
212 1675. Minimize Deviation in Array chromate00갤로그로 이동합니다. 23.02.25 31 0
211 502. IPO 이벤트(1.226) 23.02.23 25 0
209 502. IPO 개발뉴비갤로그로 이동합니다. 23.02.23 29 0
208 502. IPO chromate00갤로그로 이동합니다. 23.02.23 31 0
207 1011. Capacity To Ship Packages Within D 이벤트(1.226) 23.02.22 16 0
206 1011. Capacity To Ship Packages Within D 개발뉴비갤로그로 이동합니다. 23.02.22 26 0
205 1011. Capacity To Ship Packages Within D chromate00갤로그로 이동합니다. 23.02.22 19 0
204 540. Single Element in a Sorted Array 개발뉴비갤로그로 이동합니다. 23.02.21 25 0
203 540. Single Element in a Sorted Array 이벤트(1.226) 23.02.21 12 0
202 540. Single Element in a Sorted Array chromate00갤로그로 이동합니다. 23.02.21 20 0
201 35. Search Insert Position 이벤트(1.226) 23.02.21 18 0
200 35. Search Insert Position 개발뉴비갤로그로 이동합니다. 23.02.20 27 0
199 35. Search Insert Position chromate00갤로그로 이동합니다. 23.02.20 27 0
198 103. Binary Tree Zigzag Level Order Trav 개발뉴비갤로그로 이동합니다. 23.02.19 23 0
196 103. Binary Tree Zigzag Level Order Trav chromate00갤로그로 이동합니다. 23.02.19 19 0
195 103. Binary Tree Zigzag Level Order Trav 이벤트(1.226) 23.02.19 17 0
194 226. Invert Binary Tree chromate00갤로그로 이동합니다. 23.02.18 14 0
193 226. Invert Binary Tree 개발뉴비갤로그로 이동합니다. 23.02.18 22 0
191 226. Invert Binary Tree 이벤트(1.226) 23.02.18 21 0
189 783. Minimum Distance Between BST Nodes 개발뉴비갤로그로 이동합니다. 23.02.18 18 0
188 783. Minimum Distance Between BST Nodes chromate00갤로그로 이동합니다. 23.02.17 19 0
187 783. Minimum Distance Between BST Nodes 이벤트(1.226) 23.02.17 22 0
186 104. Maximum Depth of Binary Tree 개발뉴비갤로그로 이동합니다. 23.02.17 22 0
185 104. Maximum Depth of Binary Tree 이벤트(1.226) 23.02.16 16 0
183 104. Maximum Depth of Binary Tree chromate00갤로그로 이동합니다. 23.02.16 42 0
989. Add to Array-Form of Integer 이벤트(1.226) 23.02.15 15 0
181 989. Add to Array-Form of Integer chromate00갤로그로 이동합니다. 23.02.15 19 0
180 989. Add to Array-Form of Integer 개발뉴비갤로그로 이동합니다. 23.02.15 19 0
179 67. Add Binary 개발뉴비갤로그로 이동합니다. 23.02.14 30 0
178 67. Add Binary 이벤트(1.226) 23.02.14 20 0
177 67. Add Binary chromate00갤로그로 이동합니다. 23.02.14 29 0
176 1523. Count Odd Numbers in an Interval R chromate00갤로그로 이동합니다. 23.02.14 24 0
175 1523. Count Odd Numbers in an Interval R 이벤트(1.226) 23.02.13 17 0
174 1523. Count Odd Numbers in an Interval R 개발뉴비갤로그로 이동합니다. 23.02.13 28 0
173 2477. Minimum Fuel Cost to Report to the 개발뉴비갤로그로 이동합니다. 23.02.13 26 0
172 구현 문제 풀 때 꿀팁? 구현력 기르는 꿀팁? 있으신가요 ? [1] ㅇㅇ(180.67) 23.02.12 50 0
170 2477. Minimum Fuel Cost to Report to the 이벤트(1.226) 23.02.12 23 0
169 2477. Minimum Fuel Cost to Report to the [1] chromate00갤로그로 이동합니다. 23.02.12 29 0
168 2477. Minimum Fuel Cost to Report to the ㅇㅇ(218.234) 23.02.12 19 0
167 1129. Shortest Path with Alternating Col 이벤트(1.226) 23.02.12 17 0
166 1129. Shortest Path with Alternating Col [1] 개발뉴비갤로그로 이동합니다. 23.02.11 51 0
165 1129. Shortest Path with Alternating Col chromate00갤로그로 이동합니다. 23.02.11 35 0
163 오늘의 데일리 (feat. ChatGPT) 개발뉴비갤로그로 이동합니다. 23.02.11 46 2
162 1162. As Far from Land as Possible chromate00갤로그로 이동합니다. 23.02.10 24 0
161 1162. As Far from Land as Possible 이벤트(1.226) 23.02.10 21 0
160 데일리 [1] ㅇㅇ(223.62) 23.02.10 38 0
159 오늘은 포기 이벤트(39.7) 23.02.09 31 1
158 2306. Naming a Company. chromate00갤로그로 이동합니다. 23.02.09 21 0
157 2306. Naming a Company 개발뉴비갤로그로 이동합니다. 23.02.09 41 0
갤러리 내부 검색
제목+내용게시물 정렬 옵션

오른쪽 컨텐츠 영역

실시간 베스트

1/8

디시미디어

디시이슈

1/2