
数组
文章平均质量分 81
Coding_Reading
待我编码有成 娶你为妻可好
展开
-
leetcode260. Single Number III
先说第一种题题目:Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it原创 2017-04-09 20:00:20 · 352 阅读 · 0 评论 -
leetcode134. Gas Station
medium程度题题目: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原创 2017-04-07 16:07:15 · 390 阅读 · 0 评论 -
leetcode36. Valid Sudoku
题目:Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character '.'.A partia原创 2017-03-31 23:25:20 · 332 阅读 · 0 评论 -
leetcode42. 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,2,1,2,1]原创 2017-03-31 23:20:39 · 275 阅读 · 0 评论 -
leetcode60. Permutation Sequence
medium程度题题目: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):"1原创 2017-03-28 22:31:26 · 347 阅读 · 0 评论 -
leetcode31. Next Permutation
medium程度题题目: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原创 2017-03-27 21:05:40 · 544 阅读 · 0 评论 -
leetcode1. Two Sum
Easy程度题:题目:Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you原创 2017-03-20 14:22:52 · 342 阅读 · 0 评论 -
leetcode128. Longest Consecutive Sequence
hard程度题题目:Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements se原创 2017-03-19 21:16:02 · 401 阅读 · 0 评论 -
leetcode4. Median of Two Sorted Arrays
hard程度题题目: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)).Exam原创 2017-03-10 19:07:39 · 302 阅读 · 0 评论 -
leetcode81. Search in Rotated Sorted Array
medium题题目: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原创 2017-03-07 19:23:05 · 369 阅读 · 0 评论 -
leetcode26. Remove Duplicates from Sorted Array
从已排好序的数组中去除重复的原创 2017-02-26 21:30:53 · 286 阅读 · 0 评论 -
leetcode414. Third Maximum Number
Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n).Example 1:Input: [3, 2,原创 2016-10-26 23:16:37 · 549 阅读 · 0 评论