소개 Introduction 이것은 LeetCode의 공식 큐레이팅 된 Top 클래식 인터뷰 질문 목록입니다. 우리의 주요 인터뷰 질문은 당신의 데이터 구조 및 알고리즘을 마스터하고 코딩 기술 향상을 위해 다음 시리즈로 나뉩니다. This is LeetCode's official curated list of Top classic interview questions to help you land your dream job. Our top interview questions are divided into the following series: Easy Collection Medium Collection Hard Collection to help you master Data Structure & Algorit..
Math Most of the math questions asked in interviews do not require math knowledge beyond middle school level. We recommend: Excel Sheet Column Number, Pow(x, n) and Divide Two Integers. Happy Number Factorial Trailing Zeroes Excel Sheet Column Number Pow(x, n) Sqrt(x) Divide Two Integers Fraction to Recurring Decimal 202. Happy Number leetcode.com/problems/happy-number/ 4가지 방식이 있는데 하나는 logN / lo..
Design These problems may require you to implement a given interface of a class, and may involve using one or more data structures. These are great exercises to improve your data structure skills. We recommend: Serialize and Deserialize Binary Tree and Insert Delete GetRandom O(1) Flatten 2D Vector Serialize and Deserialize Binary Tree Insert Delete GetRandom O(1) Design Tic-Tac-Toe 251. Flatten..
leetcode.com/problems/jump-game/solution/ 내 답이 솔루션이랑 좀 다르네.. 솔루션 시간내서 읽어보자 class Solution: def canJump(self, nums: List[int]) -> bool: n = len(nums) i = 0 next_dest = 1 + i + nums[i] while i = n else False leetcode.com/problems/unique-paths/solution/ 솔루션에는 2d dp가 있네. 나는 1d dp로 함. 그리고 솔루션에는 math도 있..
leetcode.com/problems/letter-combinations-of-a-phone-number/ leetcode.com/problems/generate-parentheses/ leetcode.com/problems/permutations/ leetcode.com/problems/subsets/solution/ leetcode.com/problems/word-search/solution/
Trees and Graphs 트리는 특별한 유형의 그래프이므로 그래프를 가로 지르는 데 사용되는 두 가지 일반적인 기술도 트리에 적용 할 수 있습니다. 권장 사항 : 이진 트리 순서 순회, 각 노드 및 아일랜드 수에서 다음 오른쪽 포인터 채우기. 일부 트리 문제는 n 진 트리 형식으로도 질문 할 수 있으므로 n 진 트리가 무엇인지 알아야합니다. 참고 : Number of Islands는 트리 문제는 아니지만 그래프로 표시 할 수 있으므로 그래프 문제로 분류합니다. Tree is a special type of graphs, so the two usual techniques used to traverse a graph are also applicable to trees. We recommend: Bina..
leetcode.com/problems/add-two-numbers/ 더미헤드를 하나 만들어서, 더미헤드의 다음부터 맨뒷자리 부터 더하고, 마지막에 캐리가 있으면 하나 더 추가해줌 class Solution: def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: dummy_head = ListNode(0) curr = dummy_head carry = 0 while l1 or l2: x = l1.val if l1 else 0 y = l2.val if l2 else 0 sum = carry + x + y carry = sum // 10 curr.next = ListNode(sum % 10) curr = curr.next if l1: l1 = l..
Array and Strings 인터뷰에서 배열 및 문자열 유형의 질문이 자주 제기되었습니다. 인터뷰 중에 만날 가능성이 큽니다. 권장 사항 : 그룹 아나그램, 반복 문자가없는 가장 긴 부분 문자열, 가장 긴 회문 부분 문자열 및 누락 된 범위. Array and String type of questions were asked in interviews frequently. You will most likely encounter one during your interviews. We recommend: Group Anagrams, Longest Substring Without Repeating Characters, Longest Palindromic Substring and Missing Ranges. 3..
Others Here are some other questions that do not fit in other categories. We recommend: Majority Element, Find the Celebrity and Task Scheduler. Sum of Two Integers Evaluate Reverse Polish Notation Majority Element Find the Celebrity Task Scheduler
Math Most of the math questions asked in interviews do not require math knowledge beyond middle school level. We recommend: Excel Sheet Column Number, Pow(x, n) and Divide Two Integers. Happy Number Factorial Trailing Zeroes Excel Sheet Column Number Pow(x, n) Sqrt(x) Divide Two Integers Fraction to Recurring Decimal
Design These problems may require you to implement a given interface of a class, and may involve using one or more data structures. These are great exercises to improve your data structure skills. We recommend: Serialize and Deserialize Binary Tree and Insert Delete GetRandom O(1). Flatten 2D Vector Serialize and Deserialize Binary Tree Insert Delete GetRandom O(1) Design Tic-Tac-Toe
Dynamic Programming Here are some classic Dynamic Programming interview questions. We recommend: Unique Paths, Coin Change and Longest Increasing Subsequence. Jump Game Unique Paths Coin Change Longest Increasing Subsequence ♣ 파이썬만 풀어봄 : inner-game.tistory.com/443
Sorting and Searching These problems deal with sorting or searching in a sorted structure. We recommend: Sort Colors, Search for a Range, Merge Intervals, Search in Rotated Sorted Array, Meeting Rooms II and Search a 2D Matrix II. Sort Colors Top K Frequent Elements Kth Largest Element in an Array Find Peak Element Search for a Range Merge Intervals Search in Rotated Sorted Array Meeting Rooms I..
Backtracking Here are some of the best backtracking interview questions. Letter Combinations of a Phone Number and Generate Parentheses are both great interview questions. Also make sure you are able to write code to generate permutations / subsets (combinations), those are great backtracking exercises too. Letter Combinations of a Phone Number Generate Parentheses Permutations Subsets Word Sear..
Trees and Graphs Tree is a special type of graphs, so the two usual techniques used to traverse a graph are also applicable to trees. We recommend: Binary Tree Inorder Traversal, Populating Next Right Pointers in Each Node and Number of Islands. Note that some of the tree problems can also be asked in n-ary tree format, so make sure you know what an n-ary tree is. Note: Although Number of Island..
Linked List Linked List problems are relatively easy to master. Do not forget the Two-pointer technique, which not only applicable to Array problems but also Linked List problems as well. Another technique to greatly simplify coding in linked list problems is the dummy node trick. We recommend: Add Two Numbers and Intersection of Two Linked Lists. iterative recursive Add Two Numbers * 10/18, 12/..
Array and Strings Array and String type of questions were asked in interviews frequently. You will most likely encounter one during your interviews. We recommend: Group Anagrams, Longest Substring Without Repeating Characters, Longest Palindromic Substring and Missing Ranges. 3Sum Set Matrix Zeroes Group Anagrams Longest Substring Without Repeating Characters Longest Palindromic Substring Increa..