自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(59)
  • 资源 (1)
  • 收藏
  • 关注

原创 leetcode 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 0 1 0 1 1 1 1 1 1 1 1 1 0 0 1 0

2016-09-28 15:17:03 214

原创 leetcode 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 width of each bar

2016-09-28 10:45:20 190

原创 leetcode 83. Remove Duplicates from Sorted List

Given a sorted linked list, delete all duplicates such that each element appear only once.For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3.public ListNode deleteDuplicates

2016-09-27 17:17:34 186

原创 leetcode 82. Remove Duplicates from Sorted List II

Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example, Given 1->2->3->3->4->4->5, return 1->2->5. Given 1->1->1->2

2016-09-27 17:12:22 219

原创 leetcode 81. Search in Rotated Sorted Array II

Follow up for “Search in Rotated Sorted Array”: What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a function to determine if a given target is in the array.回顾

2016-09-27 15:32:35 198

原创 leetcode 80. Remove Duplicates from Sorted Array II

Follow up for “Remove Duplicates”: What if duplicates are allowed at most twice?For example, Given sorted array nums = [1,1,1,2,2,3],Your function should return length = 5, with the first five elemen

2016-09-27 15:26:34 303

原创 leetcode 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 vertically neig

2016-09-27 14:51:56 486

原创 leetcode 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], [1], [2],

2016-09-27 13:54:40 256

原创 leetcode 77. Combinations

Given two integers n and k, return all possible combinations of k numbers out of 1 … n.For example, If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4], ]pu

2016-09-26 23:52:01 170

原创 leetcode 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 is “BANC”.Note:

2016-09-26 19:14:44 263

原创 leetcode 75. Sort Colors

Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers 0, 1,

2016-09-22 17:18:52 339

原创 leetcode 74. Search a 2D Matrix

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 each row is

2016-09-22 16:35:15 186

原创 leetcode 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.click to show follow up.Follow up: Did you use extra space? A straight forward solution using O(mn) space

2016-09-22 16:22:15 228

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

2016-09-22 16:08:14 165

原创 leetcode 71. Simplify Path

Given an absolute path for a file (Unix-style), simplify it.For example, path = “/home/”, => “/home” path = “/a/./b/../../c/”, => “/c” click to show corner cases.Corner Cases: Did you consider the

2016-09-22 15:25:27 263

原创 leetcode 70. Climbing Stairs

You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?public int climbStairs(int n) {

2016-09-22 14:49:01 164

原创 leetcode 69. Sqrt(x)

public int mySqrt(int x) { return (int)Math.sqrt(x); } A了就不想想了

2016-09-22 14:44:24 223

原创 leetcode 68. Text Justification

Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.You should pack your words in a greedy approach; that is,

2016-09-22 11:22:47 194

原创 leetcode 67. Add Binary

Given two binary strings, return their sum (also a binary string).For example, a = “11” b = “1” Return “100”.public String addBinary(String a, String b) { int inta = Integer.parseInt(a, 2);

2016-09-21 12:17:19 367

原创 leetcode 66. Plus One

Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.13: int[]{1,3} 27: int[]{2

2016-09-21 11:54:13 161

原创 leetcode 65. Valid Number

Validate if a given string is numeric.Some examples: “0” => true ” 0.1 ” => true “abc” => false “1 a” => false “2e10” => true Note: It is intended for the problem statement to be ambiguous. You s

2016-09-21 11:09:51 354

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

2016-09-21 10:19:21 153

原创 leetcode 63. Unique Paths II

Follow up for “Unique Paths”:Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0 respectively in the grid.For ex

2016-09-21 10:06:17 207

原创 leetcode 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 reach the botto

2016-09-20 22:42:12 164

原创 leetcode 61. Rotate List

Given a list, rotate the list to the right by k places, where k is non-negative.For example: Given 1->2->3->4->5->NULL and k = 2, return 4->5->1->2->3->NULL. 需要两个指针 一个j指向5一个i指向3 所以起始的时候i指向1 j指向3

2016-09-20 21:27:03 396

原创 leetcode 60. Permutation Sequence

The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order, We get the following sequence (ie, for n = 3):“123” “132” “213” “231” “312”

2016-09-19 22:10:58 217

原创 leetcode 59. Spiral Matrix II

之前那道题目是螺旋读矩阵 这道是螺旋写入矩阵public int[][] generateMatrix(int n) { int[][] result = new int[n][n]; int temp = 1; for(int i = 0;i < (n+1)/2 && i < (n+1)/2 ;i++){//[i,i]为起点走一圈

2016-09-19 21:04:47 200

原创 leetcode 58. Length of Last Word

Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the length of last word in the string.If the last word does not exist, return 0.Note: A word is defined as

2016-09-19 20:49:06 154

原创 leetcode 57. Insert Interval

Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.Example 1:

2016-09-19 20:38:47 158

原创 leetcode 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].构造一个hashmap<起始点,终点> 先放入<1,3> 新的 键值对 i j : 对于起点 < i的且

2016-09-19 20:31:40 285

原创 leetcode 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.Determine if you are

2016-09-19 17:00:52 143

原创 leetcode 54. Spiral Matrix

Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example, Given the following matrix:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] You sh

2016-09-19 16:39:34 144

原创 leetcode 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,2,1] has the

2016-09-19 15:51:22 138

原创 leetcode 52. N-Queens II

这什么题 MDZZpublic int totalNQueens(int n) { return solveNQueens(n).size(); } List<List<Integer>> results = new ArrayList<List<Integer>>(); List<Integer> result = new ArrayList<Integer>

2016-09-19 15:13:25 188

原创 leetcode 51. N-Queens

The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the n-queens puzzle.Each solut

2016-09-19 15:08:28 151

原创 leetcode 50. Pow(x, n)

Implement pow(x, n). 实现x的n次方 x * x * … * x 递归:x^n = x^(n-1) * x 时间复杂度:o(n) 递归:x^n = x^(n/2) * x^(n-n/2) 但是我觉得这个其实也是log(n)啊 因为分解的子问题的层数是logn 但是底层有2^logn个子问题 求解最底层的问题是时间复杂度就是o(n)了吧

2016-09-19 13:59:24 280

原创 leetcode 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”] ] Note: All in

2016-09-19 10:29:53 154

原创 leetcode 48. Rotate Image

You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up: Could you do this in-place? 第一个想法是 找找转换关系 确实存在 原来第i行第j列 到新的矩阵映射为第j行第n-1-i列 如果允许新

2016-09-18 22:16:12 142

原创 leetcode 47. Permutations II

Permutations II QuestionEditorial Solution My Submissions Total Accepted: 86292 Total Submissions: 290936 Difficulty: Medium Given a collection of numbers that might contain duplicates, return al

2016-09-18 21:56:30 161

原创 leetcode 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], [3,2,1]

2016-09-18 21:46:34 116

stanford课程-----自然语言处理中的深度学习 课件

stanford课程-----自然语言处理中的深度学习 课件2-15

2016-01-18

空空如也

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

TA关注的人

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