- Today
- Total
목록leetcode (186)
작심삼일
문제 링크: https://leetcode.com/problems/kth-smallest-element-in-a-sorted-matrix/ 문제 Given an n x n matrix where each of the rows and columns is sorted in ascending order, return the $k^{th}$ smallest element in the matrix. Note that it is the $k^{th}$ smallest element in the sorted order, not the $k^{th}$ distinct element. You must find a solution with a memory complexity better than O($n^2$). 조건 n..

문제 링크: https://leetcode.com/problems/unique-paths/ 문제 There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-right corner (i.e., grid[m - 1][n - 1]). The robot can only move either down or right at any point in time. Given the two integers m and n, return the number of possible unique paths that the robot..
문제 링크: https://leetcode.com/problems/find-and-replace-pattern/ 문제 Given a list of strings words and a string pattern, return a list of words[i] that match pattern. You may return the answer in any order. A word matches the pattern if there exists a permutation of letters p so that after replacing every letter x in the pattern with p(x), we get the desired word. Recall that a permutation of lette..
문제 링크: https://leetcode.com/problems/valid-anagram/ 문제 Given two strings s and t, return true if t is an anagram of s, and false otherwise. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. 조건 1
문제 링크: https://leetcode.com/problems/flatten-binary-tree-to-linked-list/ 문제 Given the root of a binary tree, flatten the tree into a "linked list": The "linked list" should use the same TreeNode class where the right child pointer points to the next node in the list and the left child pointer is always null. The "linked list" should be in the same order as a pre-order traversal of the binary tre..
문제 링크: https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/ 문제 Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes p and q as the lowest node in T that has both p and q as descendants (where we allow a node to be a descendant of itself..
문제 링크: https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/ 문제 Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value. If target is not found in the array, return [-1, -1]. You must write an algorithm with O(log n) runtime complexity. 조건 $0$

문제 링크: https://leetcode.com/problems/partition-list/ 문제 Given the head of a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the nodes in each of the two partitions. Example 1: 조건 The number of nodes in the list is in the range [0, 200]. -100