自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

ALLEN GO

无可奉告

原创 138. Copy List with Random Pointer

A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep cop...

2019-11-20 03:43:04

阅读数 5

评论数 0

原创 692. Top K Frequent Words

Given a non-empty list of words, return the k most frequent elements. Your answer should be sorted by frequency from highest to lowest. If two words ...

2019-11-20 02:27:08

阅读数 7

评论数 0

原创 88. Merge Sorted Array

Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: The number of elements initialized in nums1 and nu...

2019-11-20 01:54:10

阅读数 5

评论数 0

原创 617. Merge Two Binary Trees

Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are ...

2019-11-11 16:29:38

阅读数 7

评论数 0

原创 接口和抽象类

接口: 定义一个规范,定义可以做什么事情。 抽象类: 是一个类,可以实现某个接口,实现其中一些方法,也可以不实现其中的方法,供子类去实现。 举例: 接口: 可开关的 - 有三个方法 close() open() lock() 抽象类: 门 子类: 木门 铁门 、。。 抽象类门可以实现这...

2019-11-11 15:42:41

阅读数 19

评论数 0

原创 973. K Closest Points to Origin

We have a list of points on the plane. Find the K closest points to the origin (0, 0). (Here, the distance between two points on a plane is the Eucl...

2019-11-04 05:45:32

阅读数 4

评论数 0

原创 819. Most Common Word

Given a paragraph and a list of banned words, return the most frequent word that is not in the list of banned words. It is guaranteed there is at le...

2019-11-04 04:16:38

阅读数 10

评论数 0

原创 179. Largest Number

Given a list of non negative integers, arrange them such that they form the largest number. Example 1: Input: [10,2] Output: "210" Example ...

2019-11-03 12:12:23

阅读数 5

评论数 0

原创 103. Binary Tree Zigzag Level Order Traversal

Given a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to right, then right to left for the next level and...

2019-11-03 05:46:34

阅读数 7

评论数 0

原创 101. Symmetric Tree

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symme...

2019-11-03 05:28:11

阅读数 8

评论数 0

原创 222. Count Complete Tree Nodes

Given a complete binary tree, count the number of nodes. Note: Definition of a complete binary tree from Wikipedia: In a complete binary tree every l...

2019-11-03 04:49:47

阅读数 7

评论数 0

原创 1047. Remove All Adjacent Duplicates In String

Given a string S of lowercase letters, a duplicate removal consists of choosing two adjacent and equal letters, and removing them. We repeatedly make...

2019-11-03 02:22:25

阅读数 3

评论数 0

原创 160. Intersection of Two Linked Lists

Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: begin to ...

2019-11-02 15:34:20

阅读数 8

评论数 0

原创 171. Excel Sheet Column Number

Given a column title as appear in an Excel sheet, return its corresponding column number. For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 A...

2019-11-02 15:05:13

阅读数 10

评论数 0

原创 314. Binary Tree Vertical Order Traversal

Given a binary tree, return the vertical order traversal of its nodes’ values. (ie, from top to bottom, column by column). If two nodes are in the sa...

2019-11-02 15:03:22

阅读数 5

评论数 0

原创 215. Kth Largest Element in an Array

Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. Example...

2019-11-02 13:58:36

阅读数 8

评论数 0

原创 118. Pascal's Triangle

Given a non-negative integer numRows, generate the first numRows of Pascal’s triangle. In Pascal’s triangle, each number is the sum of the two numbe...

2019-11-02 10:54:24

阅读数 8

评论数 0

原创 120. Triangle

Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the f...

2019-11-02 09:44:42

阅读数 6

评论数 0

原创 174. Dungeon Game

The demons had captured the princess § and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a ...

2019-11-02 09:25:10

阅读数 15

评论数 0

原创 64. Minimum Path Sum

Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path....

2019-11-02 08:54:13

阅读数 21

评论数 0

原创 96. Unique Binary Search Trees

Given n, how many structurally unique BST’s (binary search trees) that store values 1 … n? Example: Input: 3 Output: 5 Explanation: Given n = 3, ther...

2019-11-02 02:10:17

阅读数 3

评论数 0

原创 73. Set Matrix Zeroes

Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in-place. Example 1: Input: [ [1,1,1], [1,0,1], [1,1,1] ] ...

2019-11-02 02:06:56

阅读数 4

评论数 0

原创 264. Ugly Number II

Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. Example: Input: n = 10 Out...

2019-11-01 07:04:12

阅读数 6

评论数 0

原创 240. Search a 2D Matrix II

Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted ...

2019-11-01 06:43:18

阅读数 12

评论数 0

原创 1099. Two Sum Less Than K

Given an array A of integers and integer K, return the maximum S such that there exists i < j with A[i] + A[j] = S and S < K. If no i, j exist ...

2019-11-01 02:53:03

阅读数 26

评论数 0

原创 213. House Robber II

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are a...

2019-11-01 02:29:01

阅读数 11

评论数 0

原创 198. House Robber

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping y...

2019-11-01 02:00:40

阅读数 9

评论数 0

原创 69. Sqrt(x)

Implement int sqrt(int x). Compute and return the square root of x, where x is guaranteed to be a non-negative integer. Since the return type is an i...

2019-10-31 11:25:38

阅读数 7

评论数 0

原创 263. Ugly Number

Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. Exampl...

2019-10-31 11:09:21

阅读数 6

评论数 0

原创 204. Count Primes

Count the number of prime numbers less than a non-negative number, n. Example: Input: 10 Output: 4 Explanation: There are 4 prime numbers less than 1...

2019-10-31 07:21:49

阅读数 3

评论数 0

原创 100. Same Tree

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 structurally iden...

2019-10-31 06:48:35

阅读数 4

评论数 0

原创 716. Max Stack

Design a max stack that supports push, pop, top, peekMax and popMax. push(x) – Push element x onto stack. pop() – Remove the element on top of the st...

2019-10-31 06:04:37

阅读数 7

评论数 0

原创 91. Decode Ways

A message containing letters from A-Z is being encoded to numbers using the following mapping: ‘A’ -> 1 ‘B’ -> 2 … ‘Z’ -> 26 Given a non-emp...

2019-10-31 05:34:07

阅读数 5

评论数 0

原创 132. Palindrome Partitioning II

Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitionin...

2019-10-31 04:47:25

阅读数 4

评论数 0

原创 131. Palindrome Partitioning

Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. Example: ...

2019-10-31 04:10:50

阅读数 4

评论数 0

原创 139. Word Break

Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated seq...

2019-10-31 04:08:23

阅读数 5

评论数 0

原创 66. Plus One

Given a non-empty array of digits representing a non-negative integer, plus one to the integer. The digits are stored such that the most significant ...

2019-10-30 15:23:38

阅读数 7

评论数 0

原创 347. Top K Frequent Elements

Given a non-empty array of integers, return the k most frequent elements. Example 1: Input: nums = [1,1,1,2,2,3], k = 2 Output: [1,2] Example 2: Inp...

2019-10-30 14:48:01

阅读数 6

评论数 0

原创 49. Group Anagrams

Given an array of strings, group anagrams together. Example: Input: ["eat", "tea", "tan", "ate", "nat&qu...

2019-10-30 13:56:31

阅读数 7

评论数 0

原创 59. Spiral Matrix II

Given a positive integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. Example: Input: 3 Output: [ [ 1, 2, 3 ], [ ...

2019-10-30 12:27:23

阅读数 7

评论数 0

提示
确定要删除当前文章?
取消 删除