목록전체 글 (31)
코딩 공부

[LeetCode] [Easy] 283. Move Zeroes leetcode.com/problems/move-zeroes/ Move Zeroes - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 배열 안에 있는 0 뒤로 보내기 제가 설명을 잘 못해서 코드로 보는게 편할지도 모르겠네요 ㅋㅋㅋ 앞쪽부터 0을 무시하면서 나머지 숫자로 덮어씌우고 나중에 0으로 채워줍니다. 0이 나올경우를 대비해서 포인터가 필요합니다. 예) [1, 0, 3, ...] 포인터는 inde..

[LeetCode] [Easy] 415. Add Strings leetcode.com/problems/add-strings/ Add Strings - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 숫자로만 이루어진 2개의 문자열의 합을 문자열로 리턴하기 쉽게 생각하면 문자열 숫자를 int, double 같은 숫자로 바꾸고 두 수를 더해서 리턴하면 될것 같지만 그 방법은 금지 그래서 제가 생각한 방법은 char 배열로 나눠서 각자리 수를 더하기 1. toCharA..

[LeetCode] [Easy] 20. Valid Parentheses leetcode.com/problems/valid-parentheses/ Valid Parentheses - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 주어진 문자열이 유효한 괄호들인지 확인하기 이런 경우에는 스텍을 사용하면 편한것 같습니다. 1. 문자열 처음이 닫히는 괄호로 시작한다면 바로 손절 2. 스텍을 만들기 3. 열리는 괄호면 스텍에 넣어주기 4. 닫히는 괄호면 스텍 가장 위에 ..