목록Coding (23)
코딩 공부

[LeetCode] [Easy] 404. Sum of Left Leaves leetcode.com/problems/sum-of-left-leaves/ Sum of Left Leaves - 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 왼쪽 리프 노드 합 구하기 이번 문제는 자료 구조를 배웠던 분이라면 쉽게 하실 수 있는 문제에요. 리프는 트리에 마지막 부분에 있는 곳이에요. 트리하면 대부분 제귀함수로 푸는 문제더라구요. 제귀함수가 막막할땐 기본 구성인 base ..

[LeetCode] [Easy] 1323. Maximum 69 Number leetcode.com/problems/maximum-69-number/ Maximum 69 Number - 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 6, 9 바꿔서 가장 큰 수 만들기 6과 9로만 이루어진 수가 주어질 때 6이면 9로 9면 6으로 한번만 바꿀수 있는 최대값을 구하는 문제입니다. char 배열로 숫자를 넣어주고 for loop을 돌려 처음 6을 찾으면 9로 바꿔주고 ..

[LeetCode] [Easy] 1446. Consecutive Characters leetcode.com/problems/consecutive-characters/ Consecutive Characters - 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 가장 많이 연속된 캐릭터 찾기 for loop을 돌면서 전 캐릭터와 같은지 비교하고 같으면 max 값을 업데이트해주면 끝 (다르면 초기화) 비교적 쉬웠던 문제였어요 ㅎㅎ

[LeetCode] [Easy] 1480. Running Sum of 1d Array leetcode.com/problems/running-sum-of-1d-array/ Running Sum of 1d Array - 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 RunningSum 구하기 처음부터 현재 인덱스까지 합이 Running Sum 이라네요. running sum[i] = nums[0]+ nums[1] + ... + nums[i] for loop을 돌면서..

[LeetCode] [Easy] 171. Excel Sheet Column Title leetcode.com/problems/excel-sheet-column-title/ Excel Sheet Column Title - 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 엑셀 Column Title 계산하기 첫번째는 A, 두번째는 B, ... ,26번째는 Z, 27번째는 AA 이런 방식으로 주어진 수(n번째)에 맞는 문자열을 찾아봅시다. 알파벳이 26개가 있으니 26..

[LeetCode] [Easy] 136. Single Number leetcode.com/problems/single-number/ Single Number - 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번씩 나오는데 한 숫자만 한번 나옵니다. 그 숫자를 찾는게 문제에요. Hash Map을 사용해서 를 저장하고 빈도수가 1인걸 찾아줬어요. 별로 만족스럽지 않은 결과네요 ㅠㅠ XOR 을 이용해서 푸는 방법이 있더..

[LeetCode] [Easy] 412. Fizz Buzz leetcode.com/problems/fizz-buzz/ Fizz Buzz - 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 Fizz Buzz 3의 배수일때는 Fizz 5의 배수일때는 Buzz 15의 배수일때는 FizzBuzz를 나머지는 숫자를 넣는 리스트 만들기 여태 풀었던 문제중 가장 쉬웠던 것 같아요 ㅎㅎㅎ

[LeetCode] [Easy] 1394. Find Lucky Integer in an Array leetcode.com/problems/find-lucky-integer-in-an-array/ Find Lucky Integer in an Array - 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. Hash Map을 사용해서 키 값은 배열..

[LeetCode] [Easy] 1470. Shuffle the Array leetcode.com/problems/shuffle-the-array/ Shuffle the Array - 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 배열 셔플하기 [x1,x2,...,xn,y1,y2,...,yn] 형태의 배열이 있을때 [x1,y1,x2,y2,...,xn,yn] 형태의 배열로 바꾸기 (배열 길이 = 2n) 예) [2,5,1,3,4,7] => [2,3,5,4,1,7] ..

[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..