上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 30 下一页

2018年1月5日

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 sp 阅读全文

posted @ 2018-01-05 20:28 夜的第八章 阅读(155) 评论(0) 推荐(0) 编辑

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 sho 阅读全文

posted @ 2018-01-05 18:47 夜的第八章 阅读(106) 评论(0) 推荐(0) 编辑

spiral matrix II

摘要: Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example,Given n = 3, You should return the followi 阅读全文

posted @ 2018-01-05 16:02 夜的第八章 阅读(113) 评论(0) 推荐(0) 编辑

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]. 题目没有说所有间隔的 阅读全文

posted @ 2018-01-05 15:16 夜的第八章 阅读(212) 评论(0) 推荐(0) 编辑

2018年1月4日

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 maxim 阅读全文

posted @ 2018-01-04 19:32 夜的第八章 阅读(140) 评论(0) 推荐(0) 编辑

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: You s 阅读全文

posted @ 2018-01-04 16:56 夜的第八章 阅读(297) 评论(0) 推荐(0) 编辑

2018年1月3日

pow(x,n)

摘要: Implement pow(x, n). Example 1: Example 2: 实现x^n。这里要注意的是n为负数的情况。n为负数时也可以将n转成正数,这样x=1/x。。代码用了另一种方法,见代码。 阅读全文

posted @ 2018-01-03 19:13 夜的第八章 阅读(149) 评论(0) 推荐(0) 编辑

minimun 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. 阅读全文

posted @ 2018-01-03 15:43 夜的第八章 阅读(201) 评论(0) 推荐(0) 编辑

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 阅读全文

posted @ 2018-01-03 14:58 夜的第八章 阅读(119) 评论(0) 推荐(0) 编辑

combination sum、permutation、subset(组合和、全排列、子集)

摘要: combination sum I、permutation I、subsets I 是组合和、全排列、子集的第一种情况,给定数组中没有重复的元素。 combination sum II、permutation II、subsets II 是组合和、全排列、子集的第而种情况,给定数组中有重复元素。 c 阅读全文

posted @ 2018-01-03 12:56 夜的第八章 阅读(382) 评论(0) 推荐(0) 编辑

上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 30 下一页

导航