自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 114. Flatten Binary Tree to Linked List

题目Given a binary tree, flatten it to a linked list in-place.For example, given the following tree: 1 / \ 2 5 / \ \3 4 6The flattened tree should look like:1 \ 2

2018-04-25 14:52:28 244

原创 105. Construct Binary Tree from Preorder and Inorder Traversal

题目Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.For example, givenpreorder = [3,9,20,15,7]in

2018-04-24 11:14:54 284

原创 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'

2018-04-23 12:06:09 288

原创 96. Unique Binary Search Trees

题目Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2

2018-04-03 10:42:52 201

原创 85. Maximal Rectangle

题目Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area.For example, given the following matrix:1 0 1 0 01 0 1 1 11 1 1 1 1

2018-03-29 16:34:02 174

原创 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 a...

2018-03-18 17:38:30 139

原创 84. Largest Rectangle in Histogram

题目Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where

2018-03-18 12:38:54 145

原创 79. Word Search

题目Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or ve

2018-01-17 17:06:41 202

原创 76. Minimum Window Substring

题目Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S = "ADOBECODEBANC"T = "ABC"Minimum window

2018-01-12 16:23:44 191

原创 72. Edit Distance

题目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

2018-01-08 10:43:33 173

原创 62. Unique Paths

题目A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to re

2017-12-30 15:55:17 162

原创 56. Merge Intervals

题目Given a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18].分析合并有交集的区间,先对区间按照start排序,只需要考虑相邻元素前者的end和后

2017-12-27 10:50:24 186

原创 55. Jump Game

题目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.Det

2017-12-21 13:53:48 183

原创 53. Maximum Subarray

题目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 [4,-1

2017-12-10 15:26:04 152

原创 49. Group Anagrams

题目Given an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:[ ["ate", "eat","tea"], ["nat","tan"], ["bat"]]

2017-12-08 10:50:18 136

原创 48. Rotate Image

题目You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Note:You have to rotate the image in-place, which means you have to modify the input

2017-11-28 15:05:34 214

原创 Ubuntu快速下载百度云文件

Ubuntu系统本身的下载速度较慢,特别是firefox,经搜索可以使用wget,uget等方法下载,但是由于uget依赖的flashgot插件在最新的firefox上失效,所以命令行使用aria2。1. 安装aria2添加aria2的依赖:sudo add-apt-repository ppa:t-tujikawa/ppa更新依赖:sudo apt-get update安

2017-11-24 16:07:48 31736 6

原创 46. Permutations

题目Given a collection of distinct numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2],

2017-11-23 10:33:21 175

原创 34. Search for a Range

题目Given an array of integers sorted in ascending order, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).

2017-11-16 15:56:04 159

原创 33. Search in Rotated Sorted Array

题目Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search.

2017-11-16 10:41:18 139

原创 32. Longest Valid Parentheses

题目Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is

2017-11-15 15:34:58 153

原创 Ubuntu 16.04安装Teamviewer12

参考:Ubuntu 16.04 LTS安装 TeamViewer

2017-11-14 15:03:08 421

原创 31. Next Permutation

题目Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowest

2017-11-10 14:06:24 117

原创 23. Merge k Sorted Lists

题目Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.分析合并k个已排序链表为一个链表,利用优先队列和仿函数构造最小堆,需要注意仿函数的应用场景,在sort等可以排序的算法中,以及set,map,priority_queue等可排序的

2017-11-09 10:44:39 139

原创 17. Letter Combinations of a Phone Number

题目Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Input:

2017-11-08 16:54:37 146

原创 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

2017-11-07 20:36:59 166

原创 Ubuntu16.04+Nvidia GTX 1080 Ti安装

制作好U盘启动盘安装Ubuntu,总出现黑屏无法继续的情况,经查找资料,是显卡太高,需要在安装前进行一些额外配置,详情参考:Ubuntu 16.04+GTX970 黑屏无法安装解决方法分区方法参考:Ubuntu分区方案(菜鸟方案、常用方案和进阶方案)

2017-10-25 16:33:27 1680

原创 10. Regular Expression Matching

题目Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The matching should cover the entire

2017-10-23 16:17:55 183

原创 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 answ

2017-10-17 20:25:34 117

原创 4. Median of Two Sorted Arrays

题目There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).Example 1:

2017-09-24 17:30:06 169

原创 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 ans

2017-09-20 17:27:24 125

原创 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

2017-09-20 17:24:35 145

原创 42. Trapping Rain Water

题目Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example, Given [0,1,0,2,1,0,1,3,

2017-09-04 14:32:48 158

原创 173. Binary Search Tree Iterator

题目Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() will return the next smallest number in the BST.Note

2017-09-04 13:57:00 145

原创 166. Fraction to Recurring Decimal

题目Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional part is repeating, enclose the repeating part in parenth

2017-08-21 15:32:28 191

原创 650. 2 Keys Keyboard

题目Initially on a notepad only one character 'A' is present. You can perform two operations on this notepad for each step:Copy All: You can copy all the characters present on the notepad (par

2017-08-21 10:57:32 182

原创 78. Subsets

题目Given a set of distinct integers, nums, return all possible subsets.Note: The solution set must not contain duplicate subsets.For example,If nums = [1,2,3], a solution is:[ [3]

2017-08-21 10:47:22 137

原创 437. Path Sum III

题目You are given a binary tree in which each node contains an integer value.Find the number of paths that sum to a given value.The path does not need to start or end at the root or a leaf

2017-08-11 21:47:46 156

原创 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,

2017-08-08 19:45:43 157

原创 655. Print Binary Tree

题目Print a binary tree in an m*n 2D string array following these rules:The row number m should be equal to the height of the given binary tree.The column number n should always be an odd numb

2017-08-07 14:18:09 463

空空如也

空空如也

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

TA关注的人

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