목록Coding (23)
코딩 공부

[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. 닫히는 괄호면 스텍 가장 위에 ..

[LeetCode] [Easy] 1. Two Sum leetcode.com/problems/two-sum/ Two Sum - 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 주어진 배열안에 두 수의 합이 target 값이 나오는 index 구하기 1. Map을 이용하여 를 함께 저장한다. 2. for loop을 돌면서 target - nums[index]이 있는 곳을 찾으면 끝. 마지막 리턴은 딱히 할게 없어서 null을 써줬어요.