自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Leetcode-329: Longest Increasing Path in a Matrix

Given an integer matrix, find the length of the longest increasing path.From each cell, you can either move to four directions: left, right, up or down. You may NOT move diagonally or move outside o

2017-08-24 00:51:27 187

原创 Leetcode-210: Course Schedule II

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 expressed as

2017-08-22 21:13:33 154

原创 Leetcode-207: Course Schedule

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 expressed as

2017-08-22 15:01:58 172

原创 Leetcode-124: Binary Tree Maximum Path Sum

Given a binary tree, find the maximum path sum.For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connections. The pa

2017-08-20 15:03:58 158

原创 Leetcode-117: Populating Next Right Pointers in Each Node II

Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution still work?Note:You may only use constant extr

2017-08-20 14:12:25 159

原创 Leetcode-116: Populating Next Right Pointers in Each Node

Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its next right node. If t

2017-08-20 13:45:49 161

原创 Leetcode-100: Same Tree

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-08-19 11:10:29 148

原创 Leetcode-98: Validate Binary Search Tree

Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node's key.The

2017-08-19 09:50:56 192

原创 Leetcode-23: Merge k Sorted Lists

Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.将k个有序的列表归并成一个有序列表。思路:数据结构中学过的是k=2时的特例,不过实际都是每次都将所有列表中头元素最小的那个元素加入新的列表。有两种方法: 1)朴素的比较然后归并方法,对于每个新加入的元素都

2017-08-13 18:12:20 163

原创 Leetcode-22: Generate Parentheses

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))", "(()())", "(())()", "()(())",

2017-08-13 15:53:28 126

原创 Leetcode-20: Valid Parentheses

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all va

2017-08-13 15:28:35 201

原创 Leetcode-19: Remove Nth Node From End of List

Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the

2017-08-13 11:58:04 156

原创 Leetcode-15: 3Sum

Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solution set must not contain

2017-08-12 23:50:18 152

原创 Leetcode-14: Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings.给了一个string数组,求这些字符串的最长公共前缀。思路:按列比较,复杂度O(mn)。public class Solution { public String longestCom

2017-08-12 21:08:35 145

原创 Leetcode-11: Container With Most Water

Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Fin

2017-08-12 20:46:57 152

原创 Leetcode-9: Palindrome Number

Determine whether an integer is a palindrome. Do this without extra space.思路:将数字的右半边逆序记录下来,与左半边比较。public class Solution { public boolean isPalindrome(int x) { if (x < 0 || (x !

2017-08-12 20:11:31 122

转载 Leetcode-5: Longest Palindromic Substring

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"Note: "aba" is also a valid answer.

2017-08-12 17:36:37 135

原创 Leetcode-3: Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters.Examples:Given “abcabcbb”, the answer is “abc”, which the length is 3.Given “bbbbb”, the answer is “b”, with the le

2017-08-12 17:08:32 147

原创 Leetcode-2: Add Two Numbers

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return i

2017-08-12 16:33:57 163

原创 Leetcode-1:Two Sum

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 input would have exactly one solution, and you may not use the sam

2017-08-12 16:28:47 140

原创 最长回文字串--Manacher算法

回文 Manacher算法

2017-04-13 11:53:47 224

空空如也

空空如也

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

TA关注的人

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