随笔分类 - LeetCode
摘要:Remove Linked List Elements (E) 题目 Remove all elements from a linked list of integers that have value val. Example: Input: 1->2->6->3->4->5->6, val =
阅读全文
摘要:Course Schedule II (M) 题目 There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to
阅读全文
摘要:Binary Watch (E) 题目 A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59).
阅读全文
摘要:Find Right Interval (M) 题目 Given a set of intervals, for each of the interval i, check if there exists an interval j whose start point is bigger than
阅读全文
摘要:Reverse Words in a String (M) 题目 Given an input string, reverse the string word by word. Example 1: Input: "the sky is blue" Output: "blue is sky the"
阅读全文
摘要:Angle Between Hands of a Clock (M) 题目 Given two numbers, hour and minutes. Return the smaller angle (in degrees) formed between the hour and the minut
阅读全文
摘要:Non-overlapping Intervals (M) 题目 Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the inte
阅读全文
摘要:Number of Segments in a String (E) 题目 Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space ch
阅读全文
摘要:Unique Paths II (M) 题目 A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either
阅读全文
摘要:Unique Paths (M) 题目 A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either do
阅读全文
摘要:Same Tree (E) 题目 Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are s
阅读全文
摘要:Reverse Bits (E) 题目 Reverse bits of a given 32 bits unsigned integer. Example 1: Input: 00000010100101000001111010011100 Output: 001110010111100000101
阅读全文
摘要:Subsets (M) 题目 Given a set of distinct integers, nums, return all possible subsets (the power set). Note: The solution set must not contain duplicate
阅读全文
摘要:Rotate List (M) 题目 Given a linked list, rotate the list to the right by k places, where k is non-negative. Example 1: Input: 1->2->3->4->5->NULL, k =
阅读全文
摘要:Flatten a Multilevel Doubly Linked List (M) 题目 You are given a doubly linked list which in addition to the next and previous pointers, it could have a
阅读全文
摘要:Maximum Width of Binary Tree (M) 题目 Given a binary tree, write a function to get the maximum width of the given tree. The width of a tree is the maxim
阅读全文
摘要:Island Perimeter (E) 题目 You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are c
阅读全文
摘要:Additive Number (M) 题目 Additive number is a string whose digits can form additive sequence. A valid additive sequence should contain at least three nu
阅读全文
摘要:Permutation Sequence (M) 题目 The set [1,2,3,...,*n*] contains a total of n! unique permutations. By listing and labeling all of the permutations in ord
阅读全文
摘要:Plus One (E) 题目 Given a non-empty array of digits representing a non-negative integer, plus one to the integer. The digits are stored such that the mo
阅读全文

浙公网安备 33010602011771号