분류 전체보기
-
리트코드 - 206. Reverse Linked List코딩테스트 2023. 12. 20. 23:53
https://leetcode.com/problems/reverse-linked-list/description/ Reverse Linked List - LeetCode Can you solve this real interview question? Reverse Linked List - Given the head of a singly linked list, reverse the list, and return the reversed list. Example 1: [https://assets.leetcode.com/uploads/2021/02/19/rev1ex1.jpg] Input: head = [1,2,3,4,5] O leetcode.com single linked list가 주어졌을 때 이를 역순으로 변환..
-
리트코드 - 1732. Find the Highest Altitude코딩테스트 2023. 12. 20. 00:38
https://leetcode.com/problems/find-the-highest-altitude/description/?envType=study-plan-v2&envId=leetcode-75 Find the Highest Altitude - LeetCode Can you solve this real interview question? Find the Highest Altitude - There is a biker going on a road trip. The road trip consists of n + 1 points at different altitudes. The biker starts his trip on point 0 with altitude equal 0. You are given an i..
-
리트코드 - 700. Search in a Binary Search Tree코딩테스트 2023. 12. 20. 00:09
https://leetcode.com/problems/search-in-a-binary-search-tree/description/?envType=study-plan-v2&envId=leetcode-75 이진 검색 트리와 Value가 주어졌을 때, 해당 Val와 일치하는 노드를 찾을 경우 해당 노드가 루트인 하위 트리를 반환한다. 해당 노드가 존재하지 않으면 null을 반환한다. 이진 검색 트리의 특징은 루트 노드의 왼쪽은 값이 더 작은 노드, 오른 쪽에는 값이 더 큰 노드가 위치한다는 것이다. 이를 이용해서 재귀적으로 탐색을 진행하는 방식으로 문제를 해결할 수 있다. class Solution: def searchBST(self, root: Optional[TreeNode], val: int) -> O..
-
set 자료구조를 활용하여 조건 검사 속도 최적화 - 리트코드 345TIL 2023. 12. 18. 23:51
https://daelkdev.tistory.com/43 리트코드 - 345. Reverse Vowels of a String https://leetcode.com/problems/reverse-vowels-of-a-string/description/ Reverse Vowels of a String - LeetCode Can you solve this real interview question? Reverse Vowels of a String - Given a string s, reverse only all the vowels in the string and return it. daelkdev.tistory.com class Solution: def reverseVowels(self, s: str) ->..
-
리트코드 - 1207. Unique Number of Occurrences코딩테스트 2023. 12. 17. 22:52
https://leetcode.com/problems/unique-number-of-occurrences/description/?envType=study-plan-v2&envId=leetcode-75 Unique Number of Occurrences - LeetCode Can you solve this real interview question? Unique Number of Occurrences - Given an array of integers arr, return true if the number of occurrences of each value in the array is unique or false otherwise. Example 1: Input: arr = [1,2,2,1,1,3] Out..
-
리트코드 - 374. Guess Number Higher or Lower코딩테스트 2023. 12. 17. 21:33
https://leetcode.com/problems/guess-number-higher-or-lower/description/?envType=study-plan-v2&envId=leetcode-75 Guess Number Higher or Lower - LeetCode Can you solve this real interview question? Guess Number Higher or Lower - We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked. Every time you guess wrong, I will tell you wh..
-
리트코드 - 872. Leaf-Similar Trees코딩테스트 2023. 12. 17. 20:45
https://leetcode.com/problems/leaf-similar-trees/description/?envType=study-plan-v2&envId=leetcode-75 Leaf-Similar Trees - LeetCode Can you solve this real interview question? Leaf-Similar Trees - Consider all the leaves of a binary tree, from left to right order, the values of those leaves form a leaf value sequence. [https://s3-lc-upload.s3.amazonaws.com/uploads/2018/07/16/tree.png leetcode.co..