LC解题报告
文章平均质量分 81
cos2cot
这个作者很懒,什么都没留下…
展开
-
[LC解题报告]16. 3Sum Closest
问题描述:Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would原创 2017-10-27 10:13:48 · 115 阅读 · 0 评论 -
[LC]246. Strobogrammatic Number
一、问题描述A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down).Write a function to determine if a number is strobogrammatic. The number is re原创 2017-11-30 11:33:18 · 168 阅读 · 0 评论 -
[LC]345. Reverse Vowels of a String
一、问题描述Write a function that takes a string as input and reverse only the vowels of a string.Example 1:Given s = "hello", return "holle".Example 2:Given s = "leetcode", return "leotce原创 2017-12-02 11:17:41 · 160 阅读 · 0 评论 -
[LC][Array] 448. Find All Numbers Disappeared in an Array
一、问题描述Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements of [1, n] inclusive that do not appear in thi原创 2017-11-24 01:02:07 · 116 阅读 · 0 评论 -
[LC]202. happy numbers
一、问题描述Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of原创 2017-12-21 04:14:35 · 154 阅读 · 0 评论 -
78. Subsets I && 90. Subsets II
一、问题描述Given a set of distinct integers, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets.For example,If nums = [1,2,3], a s原创 2017-12-22 08:25:00 · 143 阅读 · 0 评论 -
[LC] 224. Basic Calculator
一、问题描述Implement a basic calculator to evaluate a simple expression string.The expression string may contain open ( and closing parentheses ), the plus + or minus sign -, non-negative integ原创 2017-11-26 10:33:01 · 226 阅读 · 0 评论 -
[LC]657. Judge Route Circle
一、问题描述Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the original place. The move sequence is原创 2017-11-26 10:44:52 · 155 阅读 · 0 评论 -
[LC]463. Island Perimeter
一、问题描述You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is原创 2017-11-26 11:35:03 · 135 阅读 · 0 评论 -
[LC][array][Binary Search] 278. First Bad Version
一、问题描述You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed原创 2017-12-22 22:24:51 · 134 阅读 · 0 评论 -
[LC]
一、问题描述Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the person and k is the number of people i原创 2017-11-30 10:41:13 · 131 阅读 · 0 评论 -
[LC]289. Game of Life
一、问题描述According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970."Given a b原创 2017-11-30 09:20:04 · 186 阅读 · 0 评论 -
[LC]686. Repeated String Match
一、问题描述Given two strings A and B, find the minimum number of times A has to be repeated such that B is a substring of it. If no such solution, return -1.For example, with A = "abcd" and B = "原创 2017-11-30 08:12:52 · 154 阅读 · 0 评论 -
[LC][Linked List]203. Remove Linked List Elements
问题描述:Remove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --> 3 --> 4 --> 5解法:1)原创 2017-10-31 10:43:05 · 170 阅读 · 0 评论 -
[LC]461. Hamming Distance
一、问题描述The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calculate the Hamming distance.No原创 2017-11-17 10:19:35 · 151 阅读 · 0 评论 -
[LC][Array]283. Move Zeroes
一、问题描述Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after原创 2017-11-17 11:28:36 · 99 阅读 · 0 评论 -
[LC][array] Add to List 561. Array Partition I
一、问题描述Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 t原创 2017-11-17 12:01:53 · 139 阅读 · 0 评论 -
[LC]13. Roman to Integer
一、问题描述Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.roman numerals:http://literacy.kent.edu/Minigrants/Cinci/romanchart.htm原创 2017-11-18 22:07:41 · 109 阅读 · 0 评论 -
[LC]121. Best Time to Buy and Sell Stock
一、问题描述Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of原创 2017-11-18 23:18:04 · 123 阅读 · 0 评论 -
[LC][Array]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 divisio原创 2017-11-19 11:16:10 · 137 阅读 · 0 评论 -
[LC]346. Moving Average from Data Stream
一、问题描述Given a stream of integers and a window size, calculate the moving average of all integers in the sliding window.For example,MovingAverage m = new MovingAverage(3);m.next(1) = 1m原创 2017-11-29 08:41:49 · 198 阅读 · 0 评论 -
[LC] 66. Plus One
一、问题描述Given a non-negative integer represented as a non-empty array of digits, plus one to the integer.You may assume the integer do not contain any leading zero, except the number 0 itself.原创 2017-11-29 09:03:39 · 108 阅读 · 0 评论 -
[LC][array][binary search]153. Find Minimum in Rotated Sorted Array
一、问题描述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).Find the minimum element.You ma原创 2017-12-22 23:41:23 · 122 阅读 · 0 评论