自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(31)
  • 收藏
  • 关注

原创 【Leetcode】111. Minimum Depth of Binary Tree

Description:Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.思路:本题是求二叉树的最小深度,即根节点到最近叶节点的最短

2017-06-27 09:53:40 219

原创 【Leetcode】88. Merge Sorted Array

Desciption:Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold a

2017-06-26 22:35:52 225

原创 【Leetcode】617. Merge Two Binary Trees

Description: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

2017-06-26 22:18:25 174

原创 【Leetcode】200. Number of Island

Description:Given a 2d grid map of ‘1’s (land) and ‘0’s (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You

2017-06-25 21:08:16 251

原创 【Leetcode】100. Same Tree

Description:Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical and the nodes have the same value. /

2017-06-25 00:14:07 158

原创 【Leetcode】207. Course Schedule

Description: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 take course 0 you have to first take course 1, which is expres

2017-06-19 12:46:39 259

原创 【Leetcode】520. Detect Capital

Description:Given a word, you need to judge whether the usage of capitals in it is right or not.We define the usage of capitals in a word to be right when one of the following cases holds: All let

2017-06-13 11:52:57 211

原创 8.15 NP完全问题证明

Description:Show that the following problem is NP-complete. MAXIMUM COMMON SUBGRAPH Input: Two graphs G1=(V1,E1)G_1 = (V_1, E_1) and G2=(V2,E2)G_2 = (V_2, E_2) ; a budget bb . Output: Two set o

2017-06-08 19:05:10 560

原创 【Leetcode】191. Number of 1 Bits

Description:Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight).Example:the 32-bit integer ’11’ has binary representation 000000

2017-06-05 11:36:37 156

原创 【Leetcode】283. Move Zeroes

Description: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 elements.Example:Given nums = [0, 1, 0, 3, 12], after calling you

2017-06-04 23:55:16 158

原创 【Leetcode】389. Find the Difference

Description:Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at a random position. Find the letter th

2017-05-30 22:26:26 168

原创 【Leetcode】5. Longest Palindromic Substring

Description:Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Input: "babad"Output: “bab”Explanation: “aba” is also a valid ans

2017-05-22 17:18:28 153

原创 【Leetcode】486. Predict the Winner

Description:Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each time a pla

2017-05-14 22:22:27 199

原创 【Leetcode】523. Continuous Subarray Sum

Description:Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that sums up to the multiple of k, that is,

2017-05-08 11:05:21 221

原创 【Leetcode】221. Maximal Square

Description:Given a 2D binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area.Example:Given the following matrix:1 0 1 0 01 0 1 1 11 1 1 1 11 0 0 1 0

2017-05-01 01:21:19 239

原创 【Leetcode】72. Edit Distance

Description:Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on

2017-04-21 17:44:02 212

原创 【Leetcode】139. Word Break

Description: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. Y

2017-04-20 14:20:58 177

原创 【Leetcode】64. Minimum Path Sum

Description: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 ri

2017-04-17 00:39:38 179

原创 【Leetcode】300. Longest Increasing Subsequence

Description:Given an unsorted array of integers, find the length of longest increasing subsequence.Example:Given [10, 9, 2, 5, 3, 7, 101, 18], The longest increasing subsequence is [2, 3, 7, 101], the

2017-04-08 00:11:30 237

原创 【Leetcode】45. Jump Game II

Description:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Y

2017-04-06 10:11:42 172

原创 【Leetcode】455. Assign Cookies

Description:Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the minimum si

2017-04-06 00:57:42 304

原创 【Leetcode】55.Jump Game

Description:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determin

2017-03-30 01:18:42 230

原创 【Leetcode】310. Minimum Height Trees

Description:For a undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted tree. Among all possible rooted trees, those with minimum height are

2017-03-22 21:12:10 280

原创 【Leetcode】529. Minesweeper

Description:Let’s play the minesweeper game (Wikipedia, online game)!You are given a 2D char matrix representing the game board. ‘M’ represents an unrevealed mine, ‘E’ represents an unrevealed empty sq

2017-03-18 13:47:55 252

原创 【Leetcode】112. Path Sum

Description:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Example:Given the below binary t

2017-03-16 22:58:00 256

原创 【Leetcode】312. Burst Balloons

Description:Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the balloons. If the you burst balloon i you will

2017-03-12 17:59:21 194

原创 【Leetcode】74. Search a 2D Matrix

Description: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 from left to right. The first integer of

2017-03-09 15:54:59 203

原创 【Leetcode】517. Super Washing Machines

Description:You have n super washing machines on a line. Initially, each washing machine has some dresses or is empty.For each move, you could choose any m (1 ≤ m ≤ n) washing machines, and pass o

2017-03-07 11:51:10 1226

原创 【Leetcode】152. Maximum Product Subarray

Description:Find the contiguous subarray within an array (containing at least one number) which has the largest product.Example:Given the array [2,3,-2,4], the contiguous subarray [2,3] has the largest

2017-03-06 20:33:22 193

原创 【Leetcode】53. Maximum Subarray

Description:Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [

2017-03-03 16:16:44 226

原创 【Leetcode】526. Beautiful Arrangement

Description:Suppose you have N integers from 1 to N. We define a beautiful arrangement as an array that is constructed by these N numbers successfully if one of the following is true for the ith positi

2017-02-24 19:19:00 1455

空空如也

空空如也

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

TA关注的人

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