leetCode
文章平均质量分 84
Andy_Shan
在读大学生。
展开
-
leetCode No.228 Summary Ranges
题目 Given a sorted integer array without duplicates, return the summary of its ranges. For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"]. 标签:array 相似问题: (M) Missing Ranges, (H) Data Str原创 2016-09-08 23:49:36 · 379 阅读 · 0 评论 -
leetCode No.416 Partition Equal Subset Sum
题目Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal.Note:Both the array size and原创 2016-10-09 22:29:07 · 1501 阅读 · 0 评论 -
leetCode No.417 Pacific Atlantic Water Flow
题目Given an m x n matrix of non-negative integers representing the height of each unit cell in a continent, the “Pacific ocean” touches the left and top edges of the matrix and the “Atlantic ocean” touc原创 2016-10-10 20:33:46 · 1313 阅读 · 0 评论 -
leetCode No.107 Binary Tree Level Order Traversal II
题目Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, level by level from leaf to root).For example:Given binary tree [3,9,20,null,null,15,7]原创 2016-10-11 20:26:08 · 400 阅读 · 0 评论 -
leetCode No.103 Binary Tree Zigzag Level Order Traversal
Given a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to right, then right to left for the next level and alternate between).原创 2016-11-02 21:38:51 · 359 阅读 · 0 评论 -
leetCode No.424 Longest Repeating Character Replacement
题目Given a string that consists of only uppercase English letters, you can replace any letter in the string with another letter at most k times. Find the length of a longest substring containing all rep原创 2016-10-17 17:34:51 · 1109 阅读 · 0 评论 -
leetCode No.199 Binary Tree Right Side View
Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.原创 2016-10-27 15:29:08 · 403 阅读 · 0 评论 -
leetCode No.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原创 2016-10-08 16:43:36 · 473 阅读 · 0 评论 -
leetCode No.435 Non-overlapping Intervals
题目Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.Note:You may assume the interval’s end point is always big原创 2016-10-31 17:31:25 · 1250 阅读 · 0 评论 -
leetCode No.143 Reorder List
Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes’ values.For原创 2016-11-16 12:42:36 · 547 阅读 · 0 评论 -
leetCode No.130 Surrounded Regions
题目Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region.原创 2016-11-01 18:38:19 · 376 阅读 · 0 评论 -
LeetCode No.200 Number of Islands
题目Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assum原创 2016-09-06 12:21:17 · 451 阅读 · 0 评论 -
leetCode No.378 Kth Smallest Element in a Sorted Matrix
题目Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix. Note that it is the kth smallest element in the sorted order, not原创 2016-09-05 20:44:52 · 372 阅读 · 0 评论 -
leetCode No.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 t原创 2016-08-30 10:27:13 · 675 阅读 · 0 评论 -
leetCode No.221 Maximal Square
题目Given a 2D binary matrix filled with 0’s and 1’s, find the largest square 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 11 0 0 1 0Re原创 2016-08-30 23:44:07 · 434 阅读 · 0 评论 -
leetCode No.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 define原创 2016-09-01 00:31:19 · 508 阅读 · 0 评论 -
leetCode No.238 Product of Array Except Self
题目Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Solve it without division and in O(n).原创 2016-09-01 00:53:20 · 408 阅读 · 0 评论 -
leetCode No.152 Maximum Product Subarray
题目Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],the contiguous subarray [2,3] has the largest pro原创 2016-09-13 12:02:30 · 417 阅读 · 0 评论 -
leetCode No.268 Missing Number
题目Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.For example,Given nums = [0, 1, 3] return 2.Note:Your algorithm should run in原创 2016-09-02 00:40:23 · 363 阅读 · 0 评论 -
leetCode No.134 Gas Station
题目There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to its原创 2016-09-02 01:34:28 · 413 阅读 · 0 评论 -
LeetCode No.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原创 2016-09-02 21:15:57 · 328 阅读 · 0 评论 -
leetCode No.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, and there exists one unique longest palindromic substring.标签:String 相似题目: (H) Shor原创 2016-09-03 23:26:14 · 372 阅读 · 0 评论 -
leetCode No.151 Reverse Words in a String
题目For example,Given s = “the sky is blue“,return “blue is sky the“.Clarification:What constitutes a word?A sequence of non-space characters constitutes a word.Could the input string contain leadi原创 2016-09-04 15:00:15 · 470 阅读 · 0 评论 -
leetCode No.147 Insertion Sort
Sort a linked list using insertion sort原创 2016-11-15 18:43:39 · 411 阅读 · 0 评论