06 2020 档案
摘要:Increasing Triplet Subsequence (M) 题目 Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array. Formall
阅读全文
摘要:Intersection of Two Arrays II (E) 题目 Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1], nums2 = [2
阅读全文
摘要:Permutations II (M) 题目 Given a collection of numbers that might contain duplicates, return all possible unique permutations. Example: Input: [1,1,2] O
阅读全文
摘要:Permutations (M) 题目 Given a collection of distinct integers, return all possible permutations. Example: Input: [1,2,3] Output: [ [1,2,3], [1,3,2], [2,
阅读全文
摘要:Jump Game II (H) 题目 Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array r
阅读全文
摘要:Intersection of Two Arrays (E) 题目 Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1], nums2 = [2,2]
阅读全文
摘要:Wildcard Matching (H) 题目 Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '?' and '*'. '?' Matches an
阅读全文
摘要:Multiply Strings (M) 题目 Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as
阅读全文
摘要:Trapping Rain Water (H) 题目 Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is
阅读全文
摘要:Flatten Nested List Iterator (M) 题目 Given a nested list of integers, implement an iterator to flatten it. Each element is either an integer, or a list
阅读全文
摘要:Integer Break (M) 题目 Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. R
阅读全文
摘要:Reverse Vowels of a String (E) 题目 Write a function that takes a string as input and reverse only the vowels of a string. Example 1: Input: "hello" Out
阅读全文
摘要:Coin Change (M) 题目 You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of
阅读全文
摘要:Reverse String (E) 题目 Write a function that reverses a string. The input string is given as an array of characters char[]. Do not allocate extra space
阅读全文
摘要:Range Sum Query 2D - Immutable (M) 题目 Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (ro
阅读全文
摘要:Range Sum Query - Immutable (E) 题目 Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Give
阅读全文
摘要:First Missing Positive (H) 题目 Given an unsorted integer array, find the smallest missing positive integer. Example 1: Input: [1,2,0] Output: 3 Example
阅读全文
摘要:Combination Sum II (M) 题目 Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidate
阅读全文
摘要:Combination Sum (M) 题目 Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations i
阅读全文
摘要:Count and Say (E) 题目 The count-and-say sequence is the sequence of integers with the first five terms as following: 1. 1 2. 11 3. 21 4. 1211 5. 111221
阅读全文
摘要:Rectangle Area (M) 题目 Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectangle is defined by its bottom left corner and
阅读全文
摘要:Game of Life (M) 题目 According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British
阅读全文
摘要:Sudoku Solver (H) 题目 Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy all of the following rules: E
阅读全文
摘要:Valid Sudoku (M) 题目 Determine if a 9x9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules: Each row mu
阅读全文
摘要:Search Insert Position (E) 题目 Given a sorted array and a target value, return the index if the target is found. If not, return the index where it woul
阅读全文
摘要:Find First and Last Position of Element in Sorted Array (M) 题目 Given an array of integers nums sorted in ascending order, find the starting and ending
阅读全文
摘要:Find the Duplicate Number (M) 题目 Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least
阅读全文
摘要:题目 Given an array of citations sorted in ascending order (each citation is a non-negative integer) of a researcher, write a function to compute the re
阅读全文
摘要:Search in Rotated Sorted Array (M) 题目 Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5
阅读全文
摘要:Longest Valid Parentheses (H) 题目 Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parenth
阅读全文
摘要:Next Permutation (M) 题目 Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such a
阅读全文
摘要:Substring with Concatenation of All Words (H) 题目 You are given a string, s, and a list of words, words, that are all of the same length. Find all star
阅读全文
摘要:Divide Two Integers (M) 题目 Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator. Retur
阅读全文
摘要:Implement strStr() (E) 题目 Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
阅读全文
摘要:Remove Element (E) 题目 Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extr
阅读全文
摘要:Remove Duplicates from Sorted Array (E) 题目 Given a sorted array nums, remove the duplicates in-place such that each element appear only once and retur
阅读全文
摘要:Nim Game (E) 题目 You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to re
阅读全文
摘要:Word Pattern (E) 题目 Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijec
阅读全文
摘要:Peeking Iterator (M) 题目 Given an Iterator class interface with methods: next() and hasNext(), design and implement a PeekingIterator that support the
阅读全文
摘要:Move Zeroes (E) 题目 Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero element
阅读全文
摘要:Reverse Nodes in k-Group (H) 题目 Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive inte
阅读全文
摘要:Swap Nodes in Pairs (M) 题目 Given a linked list, swap every two adjacent nodes and return its head. You may not modify the values in the list's nodes,
阅读全文
摘要:Merge k Sorted Lists (H) 题目 Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Example: Input: [ 1->4-
阅读全文
摘要:Generate Parentheses (M) 题目 Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given
阅读全文
摘要:Perfect Squares (M) 题目 Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. Exa
阅读全文
摘要:Merge Two Sorted Lists (E) 题目 Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of
阅读全文
摘要:Valid Parentheses (E) 题目 Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An inp
阅读全文
摘要:Remove Nth Node From End of List (M) 题目 Given a linked list, remove the n-th node from the end of list and return its head. Example: Given linked list
阅读全文
摘要:4Sum (M) 题目 Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b+ c + d = target? Find a
阅读全文
摘要:First Bad Version (E) 题目 You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your pr
阅读全文
摘要:Integer to English Words (H) 题目 Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than 231 - 1.
阅读全文
摘要:Letter Combinations of a Phone Number (M) 题目 Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the num
阅读全文
摘要:3Sum Closest (M) 题目 Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Retur
阅读全文
摘要:3Sum (M) 题目 Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which
阅读全文
摘要:Different Ways to Add Parentheses (M) 题目 Given a string of numbers and operators, return all possible results from computing all the different possibl
阅读全文
摘要:Longest Common Prefix (E) 题目 Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, retu
阅读全文
摘要:Roman to Integer (E) 题目 Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500
阅读全文
摘要:Container With Most Water (M) 题目 Given n non-negative integers \(a_1, a_2, ..., a_n\) , where each represents a point at coordinate \((i, a_i)\). n ve
阅读全文
摘要:Regular Expression Matching (H) Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'. '.' M
阅读全文
摘要:Integer to Roman (M) 题目 Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500
阅读全文
摘要:Bulls and Cows (E) 题目 You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what th
阅读全文
摘要:H-Index (M) 题目 Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-i
阅读全文
摘要:Missing Number (E) 题目 Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. Example 1:
阅读全文
摘要:Palindrome Number (E) 题目 Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example
阅读全文
摘要:String to Integer (atoi) (M) 题目 Implement atoi which converts a string to an integer. The function first discards as many whitespace characters as nec
阅读全文
摘要:House Robber II (M) 题目 You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All hous
阅读全文
摘要:House Robber (E) 题目 You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only co
阅读全文
摘要:Repeated DNA Sequences (M) 题目 All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying D
阅读全文
摘要:Reverse Integer (E) 题目 Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -
阅读全文
摘要:ZigZag Conversion (M) 题目 The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this
阅读全文
摘要:Median of Two Sorted Arrays (H) 题目 There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays.
阅读全文
摘要:Longest Substring Without Repeating Characters (M) 题目 Given a string, find the length of the longest substring without repeating characters. Example 1
阅读全文
摘要:Add two numbers (M) 题目 You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and eac
阅读全文
摘要:Two Sum (E) 题目 Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each inpu
阅读全文
摘要:Longest Palindromic Substring (M) 题目 Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 100
阅读全文

浙公网安备 33010602011771号