自定义博客皮肤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

无可奉告

  • 博客(111)
  • 收藏
  • 关注

原创 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 copy of the list.Example 1:Input:{"$id":"1","next...

2019-11-20 03:43:04 148

原创 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 have the same frequency, then the word with the low...

2019-11-20 02:27:08 155

原创 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 nums2 are m and n respectively.You may assume that n...

2019-11-20 01:54:10 138

原创 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 not.You need to merge them into a new binary tree....

2019-11-11 16:29:38 117

原创 接口和抽象类

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

2019-11-11 15:42:41 203

原创 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 Euclidean distance.)You may return the answer in any o...

2019-11-04 05:45:32 88

原创 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 least one word that isn’t banned, and that the answer...

2019-11-04 04:16:38 102

原创 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 2:Input: [3,30,34,5,9]Output: "9534330"Note: The result ...

2019-11-03 12:12:23 88

原创 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 alternate between).For example:Given binary tree...

2019-11-03 05:46:34 115

原创 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 symmetric: 1 / \ 2 2 / \ / \3 4 4 3 B...

2019-11-03 05:28:11 103

原创 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 level, except possibly the last, is completely fille...

2019-11-03 04:49:47 91

原创 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 duplicate removals on S until we no longer can.Re...

2019-11-03 02:22:25 114

原创 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 intersect at node c1.Example 1:Input: intersect...

2019-11-02 15:34:20 110

原创 171. Excel Sheet Column Number

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

2019-11-02 15:05:13 90

原创 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 same row and column, the order should be from left to...

2019-11-02 15:03:22 113

原创 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 1:Input: [3,2,1,5,6,4] and k = 2Output: 5Exampl...

2019-11-02 13:58:36 99

原创 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 numbers directly above it.class Solution { public L...

2019-11-02 10:54:24 118

原创 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 following triangle[ [2], [3,4], [6,5,7]...

2019-11-02 09:44:42 95

原创 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 2D grid. Our valiant knight (K) was initially posit...

2019-11-02 09:25:10 147

原创 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.Note: You can only move either down or right at an...

2019-11-02 08:54:13 148

原创 96. Unique Binary Search Trees

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

2019-11-02 02:10:17 97

原创 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]]Output: [ [1,0,1], [0,0,0], [1,0,1]]Follo...

2019-11-02 02:06:56 85

原创 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 Output: 12 Explanation: 1, 2, 3, 4, 5, 6, 8, 9, 10, 12...

2019-11-01 07:04:12 129

原创 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 in ascending from left to right.Integers in each c...

2019-11-01 06:43:18 74

原创 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 satisfying this equation, return -1.Example 1:In...

2019-11-01 02:53:03 213

原创 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 arranged in a circle. That means the first house is ...

2019-11-01 02:29:01 122

原创 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 you from robbing each of them is that adjacent house...

2019-11-01 02:00:40 86

原创 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 integer, the decimal digits are truncated and only t...

2019-10-31 11:25:38 82

原创 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.Example 1:Input: 6Output: trueExplanation: 6 = 2 × 3E...

2019-10-31 11:09:21 75

原创 204. Count Primes

Count the number of prime numbers less than a non-negative number, n.Example:Input: 10Output: 4Explanation: There are 4 prime numbers less than 10, they are 2, 3, 5, 7.找素数,每次找到素数的时候,可以把素数的倍数都标记为非...

2019-10-31 07:21:49 70

原创 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 identical and the nodes have the same value.Example 1:...

2019-10-31 06:48:35 70

原创 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 stack and return it.top() – Get the element on the t...

2019-10-31 06:04:37 143

原创 91. Decode Ways

A message containing letters from A-Z is being encoded to numbers using the following mapping:‘A’ -> 1‘B’ -> 2…‘Z’ -> 26Given a non-empty string containing only digits, determine the tot...

2019-10-31 05:34:07 72

原创 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 partitioning of s.Example:Input: "aab"Output: 1Explanation...

2019-10-31 04:47:25 76

原创 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:Input: "aab"Output:[ ["aa","b"], ["a","a","b"...

2019-10-31 04:10:50 70

原创 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 sequence of one or more dictionary words.Note:The sa...

2019-10-31 04:08:23 102

原创 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 digit is at the head of the list, and each element ...

2019-10-30 15:23:38 73

原创 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 = 2Output: [1,2]Example 2:Input: nums = [1], k = 1Output: [1]Note:You may as...

2019-10-30 14:48:01 82

原创 49. Group Anagrams

Given an array of strings, group anagrams together.Example:Input: ["eat", "tea", "tan", "ate", "nat", "bat"],Output:[ ["ate","eat","tea"], ["nat","tan"], ["bat"]]Note:All inputs will be ...

2019-10-30 13:56:31 77

原创 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: 3Output:[ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7, 6, 5 ]]class Solution { pub...

2019-10-30 12:27:23 81

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

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