12 2020 档案
摘要:Largest Rectangle in Histogram (H) 题目 Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the
阅读全文
摘要:Pseudo-Palindromic Paths in a Binary Tree (M) 题目 Given a binary tree where node values are digits from 1 to 9. A path in the binary tree is said to be
阅读全文
摘要:Reach a Number (M) 题目 You are standing at position 0 on an infinite number line. There is a goal at position target. On each move, you can either go l
阅读全文
摘要:Jump Game IV (H) 题目 Given an array of integers arr, you are initially positioned at the first index of the array. In one step you can jump from index
阅读全文
摘要:Decode Ways (M) 题目 A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Give
阅读全文
摘要:Diagonal Traverse (M) 题目 Given a matrix of M x N elements (M rows, N columns), return all elements of the matrix in diagonal order as shown in the bel
阅读全文
摘要:Next Greater Element III (M) 题目 Given a positive integer n, find the smallest integer which has exactly the same digits existing in the integer n and
阅读全文
摘要:Balanced Binary Tree (E) 题目 Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as: a
阅读全文
摘要:Smallest Range II (M) 题目 Given an array A of integers, for each integer A[i] we need to choose either x = -K or x = K, and add x to A[i] (only once).
阅读全文
摘要:Decoded String at Index (M) 题目 An encoded string S is given. To find and write the decoded string to a tape, the encoded string is read one character
阅读全文
摘要:Cherry Pickup II (H) 题目 Given a rows x cols matrix grid representing a field of cherries. Each cell in grid represents the number of cherries that you
阅读全文
摘要:4Sum II (M) 题目 Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is ze
阅读全文
摘要:Validate Binary Search Tree (M) 题目 Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The l
阅读全文
摘要:Squares of a Sorted Array (E) 题目 Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in n
阅读全文
摘要:Palindrome Partitioning (M) 题目 Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrom
阅读全文
摘要:Smallest Subtree with all the Deepest Nodes (M) 题目 Given the root of a binary tree, the depth of each node is the shortest distance to the root. Retur
阅读全文
摘要:Remove Duplicates from Sorted Array II (M) 题目 Given a sorted array nums, remove the duplicates in-place such that duplicates appeared at most twice an
阅读全文
摘要:Valid Mountain Array (E) 题目 Given an array of integers arr, return true if and only if it is a valid mountain array. Recall that arr is a mountain arr
阅读全文
摘要:Binary Search Tree Iterator (M) 题目 Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BS
阅读全文
摘要:Pairs of Songs With Total Durations Divisible by 60 (M) 题目 You are given a list of songs where the ith song has a duration of time[i] seconds. Return
阅读全文
摘要:Populating Next Right Pointers in Each Node II (M) 题目 Given a binary tree struct Node { int val; Node *left; Node *right; Node *next; } Populate each
阅读全文
摘要:Can Place Flowers (E) 题目 You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in adj
阅读全文
摘要:The kth Factor of n (M) 题目 Given two positive integers n and k. A factor of an integer n is defined as an integer i where n % i == 0. Consider a list
阅读全文
摘要:Increasing Order Search Tree (M) 题目 Given the root of a binary search tree, rearrange the tree in in-order so that the leftmost node in the tree is no
阅读全文
摘要:Linked List Random Node (M) 题目 Given a singly linked list, return a random node's value from the linked list. Each node must have the same probability
阅读全文
摘要:Maximum Depth of Binary Tree (E) 题目 Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from
阅读全文

浙公网安备 33010602011771号