随笔分类 - LeetCode
摘要:Add Two Numbers II (M) 题目 You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and
阅读全文
摘要:Find the Smallest Divisor Given a Threshold (M) 题目 Given an array of integers nums and an integer threshold, we will choose a positive integer divisor
阅读全文
摘要:Minimum Cost to Move Chips to The Same Position (E) 题目 We have n chips, where the position of the ith chip is position[i]. We need to move all the chi
阅读全文
摘要:Minimum Height Trees (M) 题目 A tree is an undirected graph in which any two vertices are connected by exactly one path. In other words, any connected g
阅读全文
摘要:Consecutive Characters (E) 题目 Given a string s, the power of the string is the maximum length of a non-empty substring that contains only one unique c
阅读全文
摘要:Insertion Sort List (M) 题目 Sort a linked list using insertion sort. A graphical example of insertion sort. The partial sorted list (black) initially c
阅读全文
摘要:Convert Binary Number in a Linked List to Integer (E) 题目 Given head which is a reference node to a singly-linked list. The value of each node in the l
阅读全文
摘要:Recover Binary Search Tree (H) 题目 You are given the root of a binary search tree (BST), where exactly two nodes of the tree were swapped by mistake. R
阅读全文
摘要:Number of Longest Increasing Subsequence (M) 题目 Given an integer array nums, return the number of longest increasing subsequences. Example 1: Input: n
阅读全文
摘要:Maximize Distance to Closest Person (M) 题目 You are given an array representing a row of seats where seats[i] = 1 represents a person sitting in the it
阅读全文
摘要:Summary Ranges (M) 题目 Given a sorted integer array without duplicates, return the summary of its ranges. Example 1: Input: [0,1,2,4,5,7] Output: ["0->
阅读全文
摘要:Linked List Cycle II (M) 题目 Given a linked list, return the node where the cycle begins. If there is no cycle, return null. To represent a cycle in th
阅读全文
摘要:Champagne Tower (M) 题目 We stack glasses in a pyramid, where the first row has 1 glass, the second row has 2 glasses, and so on until the 100th row. Ea
阅读全文
摘要:Stone Game IV (H) 题目 Alice and Bob take turns playing a game, with Alice starting first. Initially, there are n stones in a pile. On each player's tur
阅读全文
摘要:Bag of Tokens (M) 题目 You have an initial power of P, an initial score of 0, and a bag of tokens where tokens[i] is the value of the ith token (0-index
阅读全文
摘要:Minimum Depth of Binary Tree (E) 题目 Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from
阅读全文
摘要:Asteroid Collision (M) 题目 We are given an array asteroids of integers representing asteroids in a row. For each asteroid, the absolute value represent
阅读全文
摘要:Clone Graph (M) 题目 Given a reference of a node in a connected undirected graph. Return a deep copy (clone) of the graph. Each node in the graph contai
阅读全文
摘要:Best Time to Buy and Sell Stock IV (H) 题目 You are given an integer array prices where prices[i] is the price of a given stock on the ith day. Design a
阅读全文
摘要:Search a 2D Matrix (M) 题目 Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integer
阅读全文

浙公网安备 33010602011771号