02 2019 档案
摘要:"132. Word Search II" / "212. Word Search II" 本题难度: Hard Topic: Data Structure Tire/DFS Description Given a 2D board and a list of words from the dict
阅读全文
摘要:"79. Word Search" 本题难度: Medium Topic: DFS Description Given a 2D board and a word, find if the word exists in the grid. The word can be constructed fr
阅读全文
摘要:"4. Ugly Number II" / "264. Ugly Number II" 本题难度: Medium Topic: Data Structure Description Ugly number is a number that only have factors 2, 3 and 5.
阅读全文
摘要:"263. Ugly Number" 本题难度: Easy Topic: Data Structure Description 我的代码
阅读全文
摘要:"12. Min Stack" / "155. Min Stack" 本题难度: Medium/Easy Topic: Data Structure Description import heapq import collections class MinStack: def __init__(se
阅读全文
摘要:"225. Implement Stack using Queues" Implement the following operations of a stack using queues. push(x) Push element x onto stack. pop() Removes the e
阅读全文
摘要:"40. Implement Queue by Two Stacks" / "225. Implement Stack using Queues" 本题难度: Medium/Easy Topic: Data Structure stack/queue Description As the title
阅读全文
摘要:"128. Longest Consecutive Sequence" / "23. Merge k Sorted Lists" 本题难度: Hard/Medium Topic: Data Structure heap(别人的代码1用的是heap) Description Merge k sorte
阅读全文
摘要:"124. Longest Consecutive Sequence" / "128. Longest Consecutive Sequence" 本题难度: Medium/Hard Topic: Data Structure Description Given an unsorted array
阅读全文
摘要:"107. Word Break" / "139. Word Break" 本题难度: Medium Topic: Dynamic Programming Description Given a string s and a dictionary of words dict, determine i
阅读全文
摘要:"109. Triangle" / "120. Triangle" 本题难度: Medium Topic: Dynamic Programming Description Given a triangle, find the minimum path sum from top to bottom.
阅读全文
摘要:"118. Distinct Subsequences" / "115. Distinct Subsequences" 本题难度: Medium/Hard Topic: Dynamic Programming Description Given a string S and a string T,
阅读全文
摘要:"119. Edit Distance" / "72. Edit Distance" 本题难度: Medium/Hard Topic: Dynamic Programming Description Given two words word1 and word2, find the minimum
阅读全文
摘要:"191. Maximum Product Subarray" / "152. Maximum Product Subarray" 本题难度: Medium Topic: Dynamic Programming Description Given an integer array nums, fin
阅读全文
摘要:"41. Maximum Subarray" / "53. Maximum Subarray" 本题难度: Eas Topic: Dynamic Programming Description Given an array of integers, find a contiguous subarra
阅读全文
摘要:"111. Climbing Stairs" / "70. Climbing Stairs" 本题难度: Easy Topic: Dynamic Programming Description You are climbing a stair case. It takes n steps to re
阅读全文
摘要:"115. Unique Paths II" / "63. Unique Paths II" 本题难度: Easy/Medium Topic: Dynamic Programming Description Follow up for "Unique Paths": Now consider if
阅读全文
摘要:"62. Unique Paths" 本题难度: Easy Topic: Dynamic Programming Description A robot is located at the top left corner of a m x n grid (marked 'Start' in the
阅读全文
摘要:"15. Permutations" / "46. Permutations" 本题难度: Medium Topic: Search & Recursion Description Given a list of numbers, return all possible permutations.
阅读全文
摘要:"16. Permutations II" / "47. Permutations II" 本题难度: Medium Topic: Search & Recursion Description Given a list of numbers with duplicate number in it.
阅读全文
摘要:"17. Subsets" / "78. Subsets" 本题难度: Medium Topic: Search & Recursion Description Given a set of distinct integers, return all possible subsets. Exampl
阅读全文
摘要:"18. Subsets II" / "90. Subsets II" 本题难度: Medium Topic: Search & Recursion Description Given a collection of integers that might contain duplicates, n
阅读全文
摘要:"33. N Queens" / "51. N Queens" 本题难度: Medium/Hard Topic: Search & Recursion Description The n queens puzzle is the problem of placing n queens on an n
阅读全文
摘要:"127. Topological Sorting" 本题难度: Medium Topic: Search & Recursion Description Given an directed graph, a topological order of the graph nodes is defin
阅读全文
摘要:"135. Combination Sum" / "39. Combination Sum" 本题难度: Medium Topic: Search & Recursion Description Given a set of candidate numbers (C) and a target nu
阅读全文
摘要:"152. Combinations" / "77. Combinations" 本题难度: Medium Topic: Search & Recursion Description Given two integers n and k, return all possible combinatio
阅读全文
摘要:"7. Serialize and Deserialize Binary Tree" / "297. Serialize and Deserialize Binary Tree" 本题难度: Medium/Hard Topic: Binary Tree Description Design an a
阅读全文
摘要:"11. Search Range in Binary Search Tree" 本题难度: Medium Topic: Binary Tree Description Given a binary search tree and a range [k1, k2], return all eleme
阅读全文
摘要:"700. Search in a Binary Search Tree" 本题难度: Easy Topic: Binary Tree Description Given the root node of a binary search tree (BST) and a value. You nee
阅读全文
摘要:"73. Construct Binary Tree from Preorder and Inorder Traversal" /[105. Construct Binary Tree from Preorder and Inorder Traversal ](https://leetcode.co
阅读全文
摘要:"95. Validate Binary Search Tree" / "98. Validate Binary Search Tree" 本题难度: Easy Topic: Binary Tree Description Given a binary tree, determine if it i
阅读全文
摘要:"66. Binary Tree Preorder Traversal" / "144. Binary Tree Preorder Traversal" 本题难度: Easy/Medium Topic: Binary Tree Description Given a binary tree, ret
阅读全文
摘要:"69. Binary Tree Level Order Traversal" / "102. Binary Tree Level Order Traversal" 本题难度: Easy/Medium Topic: Binary Tree Description Given a binary tre
阅读全文
摘要:"85. Insert Node in a Binary Search Tree" / "701. Insert into a Binary Search Tree" 本题难度: Easy/Medium Topic: Binary Tree Given a binary search tree an
阅读全文
摘要:"93. Balanced Binary Tree" / "110. Balanced Binary Tree" 本题难度: Easy Topic: Binary Tree Description Given a binary tree, determine if it is height bala
阅读全文
摘要:"97. Maximum Depth of Binary Tree" / "104. Maximum Depth of Binary Tree" 本题难度: Easy Topic: Binary Tree Description Given a binary tree, find its maxim
阅读全文
摘要:"98. Sort List" / "148. Sort List" 本题难度: Medium Topic: Linked List Description Sort a linked list in O(n log n) time using constant space complexity.
阅读全文
摘要:"99. Reorder List" /[143. Reorder List ](https://leetcode.com/problems/reorder list/) 本题难度: Medium Topic: Linked List Description Given a singly linke
阅读全文
摘要:"102. Linked List Cycle" / "141. Linked List Cycle" 本题难度: Medium/Easy Topic: Linked List Description A linked list is given such that each node contai
阅读全文
摘要:"106. Convert Sorted List to Binary Search Tree" / "109. Convert Sorted List to Binary Search Tree" 本题难度: Medium/Easy Topic: Linked List Description A
阅读全文
摘要:"105. Copy List with Random Pointer" / "138. Copy List with Random Pointer" 本题难度: Medium Topic: Linked List A linked list is given such that each node
阅读全文
摘要:"106. Convert Sorted List to Binary Search Tree" / "109. Convert Sorted List to Binary Search Tree" 本题难度: Medium/Medium Topic: Linked List Description
阅读全文
摘要:"170. Rotate List" / "61. Rotate List" 本题难度: Medium Topic: Linked List Description Given a linked list, remove the nth node from the end of list and r
阅读全文
摘要:"35. Reverse Linked List" / "206. Reverse Linked List" 本题难度: Easy Topic: Linked List Description Reverse a linked list. Example Example1: For linked l
阅读全文
摘要:"96. Partition List" / "86. Partition List" 本题难度: Easy/Medium Topic: Linked List Description Given a linked list and a value x, partition it such that
阅读全文
摘要:"112. Remove Duplicates from Sorted List" / "83. Remove Duplicates from Sorted List" 本题难度: Easy/Medium Topic: Linked List Description Given a sorted l
阅读全文
摘要:"165. Merge Two Sorted Lists" / "21. Merge Two Sorted Lists" 本题难度: Easy Topic: Linked List Description Merge two sorted (ascending) linked lists and r
阅读全文
摘要:主要参考资料: "RUNOOB.COM Python3 面向对象" 之前没有仔细看过python的面向对象编程,因为Linked List中用到了定义新的类,所以简单看了一下教程。 因为之前学过了C/C++ 所以只是简单的记录了一下之前不知道/忘了的点。 笔记和代码主要摘录自RUNOOB.COM的
阅读全文
摘要:"174. Remove Nth Node From End of List" / "19. Remove Nth Node From End of List" 本题难度: Easy/Medium Topic: Linked List Description Given a linked list,
阅读全文
摘要:"" 本题难度: Medium Topic: Greedy Description Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of
阅读全文
摘要:"52. Next Permutation" 本题难度: Medium Topic: Greedy Description "52. Next Permutation" 本题难度: Medium Topic: Greedy Description Given a list of integers,
阅读全文
摘要:"116. Jump Game" / "55. Jump Game" 本题难度: Medium Topic: Greedy Description Given an array of non negative integers, you are initially positioned at the
阅读全文
摘要:"182. Delete Digits" 本题难度: Medium Topic: Greedy Description Given string A representative a positive integer which has N digits, remove any k digits o
阅读全文
摘要:"184. Largest Number" / "179. Largest Number" 本题难度: Medium Topic: Greedy Description 184. Largest Number 中文English Given a list of non negative intege
阅读全文
摘要:"187. Gas Station" / "134. Gas Station" 本题难度: Medium Topic: Greedy Description There are N gas stations along a circular route, where the amount of ga
阅读全文
摘要:"46. Majority Element" /[169. Majority Element(https://leetcode.com/problems/majority element/) 本题难度: Easy Topic: Greedy Description Given an array of
阅读全文
摘要:"82. Single Number" / "136. Single Number" 本题难度: Easy Topic: Greedy Description Given a non empty array of integers, every element appears twice excep
阅读全文
摘要:"163. Unique Binary Search Trees" 本题难度: Medium Topic: Bit Manipulation Description Given n, how many structurally unique BSTs (binary search trees) th
阅读全文
摘要:"179. Update Bits" 本题难度: Medium Topic: Bit Manipulation Description Given two 32 bit numbers, N and M, and two bit positions, i and j. Write a method
阅读全文
摘要:"140. Fast Power" 本题难度: Medium Topic: Bit Manipulation Description Calculate the a^n % b where a, b and n are all 32bit positive integers. Example For
阅读全文
摘要:"180. Binary Representation" 本题难度: Hard Topic: Bit Manipulation Description Given a (decimal e.g. 3.72) number that is passed in as a string, return t
阅读全文
摘要:"191. Number of 1 Bits" 本题难度: Easy Topic: Bit Manipulation Description Write a function that takes an unsigned integer and return the number of '1' bi
阅读全文
摘要:"2. Trailing Zeros" 本题难度: Easy Topic: Math&Bit Manipulation Description Write an algorithm which computes the number of trailing zeros in n factorial.
阅读全文
摘要:"142. O(1) Check Power of 2" 本题难度: Easy Topic: Math&Bit Manipulation Description Using O(1) time to check whether an integer n is a power of 2. Exampl
阅读全文
摘要:"181. Flip Bits" 本题难度: Easy Topic: Math&Bit Manipulation Description Determine the number of bits required to flip if you want to convert integer n to
阅读全文
摘要:"183. Wood Cut" 本题难度: Hard Topic: Binary Search Description Given n pieces of wood with length L[i] (integer array). Cut them into small pieces to gua
阅读全文
摘要:"[Lintcode]61. Search for a Range" / "[Leetcode]34. Find First and Last Position of Element in Sorted Array" 本题难度: Medium/Medium Topic: Binary Search
阅读全文
摘要:"81. Search in Rotated Sorted Array II" 本题难度: Medium Topic: Binary Search 类似 "[Lintcode]62. Search in Rotated Sorted Array/[Leetcode]33. Search in Rot
阅读全文
摘要:"[Lintcode]62. Search in Rotated Sorted Array" / "[Leetcode]33. Search in Rotated Sorted Array" 本题难度: Medium/Medium Topic: Binary Search Description 6
阅读全文
摘要:"[Lintcode]74. First Bad Version" "[Leetcode]278. First Bad Version" 本题难度: [Lintcode]Medium/[Leetcode] Topic: Binary Search Description 我的代码 for Leet
阅读全文
摘要:"162. Find Peak Element" Description A peak element is an element that is greater than its neighbors. Given an input array nums, where nums[i] ≠ nums[
阅读全文
摘要:"75. Find Peak Element" Description There is an integer array which has the following features: The numbers in adjacent positions are different. A[0]
阅读全文
摘要:14. First Position of TargetDescriptionFor a given sorted array (ascending order) and a target number, find the first index of th...
阅读全文
摘要:141. Sqrt(x)DescriptionSqrt(x)Implement int sqrt(int x).Compute and return the square root of x.ExampleExample 1:Input: 0Output:...
阅读全文
摘要:60. Search Insert PositionDescriptionGiven a sorted array and a target value, return the index if the target is found. If not, re...
阅读全文
摘要:28.Search a 2D MatrixDescriptionDescriptionWrite an efficient algorithm that searches for a value in an m x n matrix.This matrix ...
阅读全文
摘要:31. Partition ArrayDescriptionGiven an array nums of integers and an int k, partition the array (i.e move the elements in “nums”)...
阅读全文
摘要:15. 3SumDescriptionGiven an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique...
阅读全文
摘要:59. 3Sum ClosestDescriptionGiven an array S of n integers, find three integers in S such that the sum is closest to a given numbe...
阅读全文
浙公网安备 33010602011771号