알고리즘/leetcode16 [Leetcode/JS] 111. Minimum Depth of Binary Tree 문제링크 111. Minimum Depth of Binary Tree https://leetcode.com/problems/minimum-depth-of-binary-tree/description/ Minimum Depth of Binary Tree - LeetCode Can you solve this real interview question? Minimum Depth of Binary Tree - Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. Note: A leaf.. 2023. 7. 13. [leetcode/JS] 234. Palindrome Linked List / Javascript 문제링크 https://leetcode.com/problems/merge-two-sorted-lists/ Merge Two Sorted Lists - 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. 두 list를 비교 후 남은 node 처리 할 때 crt.next = list1 || list2 이렇게 깔끔하게 처리 해줄 수 있다. 2. crt.next 를 지정 해 준 후 crt = crt.next 로 다음 노드로 이동 해 주어야 한.. 2022. 8. 27. [leetcode/JS] 234. Palindrome Linked List / Javascript 문제링크 https://leetcode.com/problems/palindrome-linked-list/ Palindrome Linked List - 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 기억하면 좋을 것 배열의 순서를 정반대로 뒤바꾸고 싶을때 어떻게 할까 ? 바로 reverse 배열 내장 함수를 사용하면 된다. 그런데 문자열을 정반대로 바꾸어 주고 싶다면 ? split() reverse() join() 세가지를 기억하자 split('') 은 문자열을 .. 2022. 8. 25. [leetcode/JS] 70. Climbing Stairs / Javascript 문제링크 https://leetcode.com/problems/climbing-stairs/ Climbing Stairs - 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 기억하면 좋을 것 이 문제는 recursive로 풀면 시간 초과로 통과하지 못한다. memoization 을 이용해 빈 배열을 생성하고 , 거기에 결과값을 저장 해 나가며 최종 결과를 반환해야한다. DP는 하향식(Top-Down 방식), 상향식(Bottom-UP 방식) 두 가지 방식으로 풀 수.. 2022. 8. 23. 이전 1 2 3 4 다음