leetcode.com/problems/valid-mountain-array/ 941. Valid Mountain Array Easy 57981Add to ListShare Given an array of integers arr, return true if and only if it is a valid mountain array. Recall that arr is a mountain array if and only if: arr.length >= 3 There exists some i with 0 arr[i + 1] > ... > arr[arr.length ..
leetcode.com/problems/binary-search-tree-iterator/ 1번과 2번은 공간복잡도에서 차이가 있기 때문에 2번을 선택해야한다. 1번은 모든 노드를 저장하고 2번은 노드의 높이만큼 저장한다. 물론 기울어진 트리의 경우에는 같다. 173. Binary Search Tree Iterator Medium 3097288Add to ListShare Implement the BSTIterator class that represents an iterator over the in-order traversal of a binary search tree (BST): BSTIterator(TreeNode root) Initializes an object of the BSTIterator c..
leetcode.com/problems/pairs-of-songs-with-total-durations-divisible-by-60/ 1010. Pairs of Songs With Total Durations Divisible by 60 Medium 75962Add to ListShare You are given a list of songs where the ith song has a duration of time[i] seconds. Return the number of pairs of songs for which their total duration in seconds is divisible by 60. Formally, we want the number of indices i, j such that..
leetcode.com/problems/missing-ranges/ You are given an inclusive range [lower, upper] and a sorted unique integer array nums, where all elements are in the inclusive range. A number x is considered missing if x is in the range [lower, upper] and x is not in nums. Return the smallest sorted list of ranges that cover every missing number exactly. That is, no element of nums is in any of the ranges..
leetcode.com/problems/spiral-matrix-ii/ Spiral Matrix II - 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 Overview There are various problems in spiral matrix series with some variations like Spiral Matrix and Spiral Matrix III. In order to solve such questions, the core idea is t..
Others Here are some other questions that do not fit in other categories. We recommend: Trapping Rain Water and The Skyline Problem. If you'd like more challenge, we highly recommend you to solve the last two problems: The Skyline Problem and Largest Rectangle in Histogram. Both problems are very fun to solve and can be solved with many different approaches. Queue Reconstruction by Height Trappi..
Math Most of the math questions asked in interviews do not require math knowledge beyond middle school level. We recommend Max Points on a Line. Largest Number Max Points on a Line leetcode.com/problems/largest-number/solution/ leetcode.com/problems/max-points-on-a-line/solution/
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: LRU Cache, Implement Trie (Prefix Tree) and Find Median from Data Stream. LRU Cache Implement Trie (Prefix Tree) Flatten Nested List Iterator Find Median from Data Stream Range Sum Query ..
Dynamic Programming Here are some classic Dynamic Programming interview questions. We recommend: Best Time to Buy and Sell Stock with Cooldown and Word Break. Burst Balloons is a great problem too, highly recommended for the more advanced level. Maximum Product Subarray Decode Ways Best Time to Buy and Sell Stock with Cooldown Perfect Squares Word Break Word Break II Burst Balloons leetcode.com/..
Sorting and Searching These problems deal with sorting or searching in a sorted structure. We recommend: Median of Two Sorted Arrays. Hands down one of the best interview questions. Wiggle Sort II Kth Smallest Element in a Sorted Matrix Median of Two Sorted Arrays leetcode.com/problems/wiggle-sort-ii/ leetcode.com/problems/kth-smallest-element-in-a-sorted-matrix/solution/ leetcode.com/problems/m..
Backtracking Here are some of the best backtracking interview questions. We recommend: Word Search II, Remove Invalid Parentheses and Regular Expression Matching. Palindrome Partitioning Word Search II Remove Invalid Parentheses Wildcard Matching Regular Expression Matching leetcode.com/problems/palindrome-partitioning/solution/ leetcode.com/problems/word-search-ii/solution/ leetcode.com/problem..
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: Word Ladder, Lowest Common Ancestor of a Binary Tree, Course Schedule, Longest Increasing Path in a Matrix and Alien Dictionary. 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. ..
Linked List There are not a lot of difficult Linked List problems. However, these Linked List problems do require some thought. We recommend all of these problems, all of them are classic Linked List interview questions, especially Copy List with Random Pointers which may seem impossible to solve at first glance. Merge k Sorted Lists Sort List Copy List with Random Pointer leetcode.com/problems/..
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: Product of Array Except Self, Spiral Matrix, First Missing Positive, Longest Substring with At Most K Distinct Characters, Sliding Window Maximum and Minimum Window Substring. The last three problems are a bit more challenging, so feel..
Introduction 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 & Algorithms and improve your coding skills. Just like any other skills, coding interview is one area where you can greatly i..
leetcode.com/contest/weekly-contest-218 Contest - 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번 leetcode.com/problems/goal-parser-interpretation/ Goal Parser Interpretation - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your kno..
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..
leetcode.com/problems/populating-next-right-pointers-in-each-node-ii/ Populating Next Right Pointers in Each Node II - 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로 풀도록 할것. Given a binary treestruct Node { int val; Node *left; Node *right; Node *next; } Populate each next p..
leetcode.com/problems/can-place-flowers/ Can Place Flowers - 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 문제는 쉽다. and 와 or을 잘 이해하고, 조건문을 얼마나 아름답게 쓰냐의 차이.. public class Solution { public boolean canPlaceFlowers(int[] flowerbed, int n) { int i = 0, count = 0; while (i < flowerbed...
Others Here are some other questions that do not fit in other categories. We recommend: Number of 1 Bits Valid Parentheses. 191. Number of 1 Bits leetcode.com/problems/number-of-1-bits/ Write a function that takes an unsigned integer and returns the number of '1' bits it has (also known as the Hamming weight). Note: Note that in some languages such as Java, there is no unsigned integer type. In ..
Math Most of the math questions asked in interviews do not require math knowledge beyond middle school level. We recommend: Count Primes Power of Three. 412. Fizz Buzz leetcode.com/problems/fizz-buzz/ 피즈버즈 하나 가지고도 이런 다양한 토론을 할수 있군.. Solution You must have played FizzBuzz as kids. FizzBuzz charm never gets old. And so here we are looking at how you can take on one step at a time and impress your ..
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: Shuffle an Array Min Stack. 384. Shuffle an Array leetcode.com/problems/shuffle-an-array/ Initial Thoughts Normally I would display more than two approaches, but shuffling is deceptively ..