随笔分类 -  LeetCode

上一页 1 ··· 51 52 53 54 55 56 57 58 59 ··· 61 下一页
摘要:Given an integer array nums, find the subarray with the largest sum, and return its sum. Example 1: Input: nums = [-2,1,-3,4,-1,2,1,-5,4] Output: 6 Ex 阅读全文
posted @ 2015-03-30 09:20 Grandyang 阅读(43345) 评论(11) 推荐(1) 编辑
摘要:You are given a 0-indexed array of integers nums of length n. You are initially positioned at nums[0]. Each element nums[i] represents the maximum len 阅读全文
posted @ 2015-03-28 03:31 Grandyang 阅读(31692) 评论(4) 推荐(2) 编辑
摘要:You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your maximum ju 阅读全文
posted @ 2015-03-27 13:17 Grandyang 阅读(31453) 评论(15) 推荐(2) 编辑
摘要:Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals 阅读全文
posted @ 2015-03-27 02:53 Grandyang 阅读(37541) 评论(21) 推荐(1) 编辑
摘要:You are given an array of non-overlapping intervals intervals where intervals[i] = [starti, endi] represent the start and the end of the ith interval 阅读全文
posted @ 2015-03-26 00:59 Grandyang 阅读(22796) 评论(0) 推荐(0) 编辑
摘要:Given a positive integer n, generate an n x n matrix filled with elements from 1 to n2 in spiral order. Example 1: Input: n = 3 Output: [[1,2,3],[8,9, 阅读全文
posted @ 2015-03-24 14:54 Grandyang 阅读(11628) 评论(17) 推荐(0) 编辑
摘要:Given an m x n matrix, return all elements of the matrix in spiral order. Example 1: Input: matrix = [[1,2,3],[4,5,6],[7,8,9]] Output: [1,2,3,6,9,8,7, 阅读全文
posted @ 2015-03-24 14:22 Grandyang 阅读(26164) 评论(9) 推荐(1) 编辑
摘要:Given a collection of numbers, nums, that might contain duplicates, return all possible unique permutations in any order. Example 1: Input: nums = [1, 阅读全文
posted @ 2015-03-23 14:57 Grandyang 阅读(30255) 评论(10) 推荐(2) 编辑
摘要:Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order. Example 1: Input: nums = [1,2, 阅读全文
posted @ 2015-03-23 08:29 Grandyang 阅读(54421) 评论(1) 推荐(0) 编辑
摘要: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 s 阅读全文
posted @ 2015-03-23 01:44 Grandyang 阅读(22089) 评论(6) 推荐(2) 编辑
摘要:Given the head of a linked list, rotate the list to the right by k places. Example 1: Input: head = [1,2,3,4,5], k = 2 Output: [4,5,1,2,3] Example 2: 阅读全文
posted @ 2015-03-21 13:49 Grandyang 阅读(14906) 评论(5) 推荐(0) 编辑
摘要:You are given an m x n integer array grid. There is a robot initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to th 阅读全文
posted @ 2015-03-20 15:13 Grandyang 阅读(16107) 评论(7) 推荐(1) 编辑
摘要:There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-rig 阅读全文
posted @ 2015-03-20 14:30 Grandyang 阅读(22882) 评论(7) 推荐(2) 编辑
摘要: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 @ 2015-03-20 11:50 Grandyang 阅读(17724) 评论(4) 推荐(3) 编辑
摘要:Given an array of strings words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right 阅读全文
posted @ 2015-03-19 14:39 Grandyang 阅读(15848) 评论(3) 推荐(3) 编辑
摘要:Given a string path, which is an absolute path (starting with a slash '/') to a file or directory in a Unix-style file system, convert it to the simpl 阅读全文
posted @ 2015-03-18 14:39 Grandyang 阅读(18483) 评论(8) 推荐(2) 编辑
摘要:Given a non-negative integer x, return the square root of x rounded down to the nearest integer. The returned integer should be non-negative as well. 阅读全文
posted @ 2015-03-18 10:10 Grandyang 阅读(30566) 评论(15) 推荐(2) 编辑
摘要:Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2. You have the following three operations 阅读全文
posted @ 2015-03-17 13:00 Grandyang 阅读(30284) 评论(13) 推荐(2) 编辑
摘要:Given an m x n integer matrix matrix, if an element is 0, set its entire row and column to 0's. You must do it in place. Example 1: Input: matrix = [[ 阅读全文
posted @ 2015-03-16 13:18 Grandyang 阅读(18072) 评论(7) 推荐(0) 编辑
摘要:Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in 阅读全文
posted @ 2015-03-16 10:50 Grandyang 阅读(24657) 评论(6) 推荐(2) 编辑

上一页 1 ··· 51 52 53 54 55 56 57 58 59 ··· 61 下一页
Fork me on GitHub