水中的鱼
Showing posts with label
解题报告
.
Show all posts
Showing posts with label
解题报告
.
Show all posts
Monday, August 7, 2017
[Leetcode] Flatten 2D Vector, Solution
›
Implement an iterator to flatten a 2d vector. For example, Given 2d vector = [ [1,2], [3], [4,5,6] ] By calling next repeat...
19 comments:
[Leetcode] Kth Smallest Element in a BST, Solution
›
Given a binary search tree, write a function kthSmallest to find the k th smallest element in it. Note: You may assume k is always v...
5 comments:
[Leetcode] Basic Calculator II, Solution
›
Implement a basic calculator to evaluate a simple expression string. The expression string contains only non-negative integers, + , -...
1 comment:
[Leetcode] Maximal Square, Solution
›
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 exampl...
[Leetcode] Course Schedule, Solution
›
There are a total of n courses you have to take, labeled from 0 to n - 1 . Some courses may have prerequisites, for example to take ...
5 comments:
[Leetcode] One Edit Distance, Solution
›
Given two strings S and T, determine if they are both one edit distance apart. [Thoughts] 这是个简化版。只要考虑几种可能, 如果s.length == t.length,只要看看不相同...
44 comments:
[Leetcode] Min Stack, Solution
›
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. ...
[Leetcode] Find Peak Element, Solution
›
A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1] , find a peak element and ...
[Leetcode] Fraction to Recurring Decimal, Solution
›
Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. If the fractional part...
[Leetcode] Number of Islands, Solution
›
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 ...
[Leetcode] Basic Calculator, Solution
›
Implement a basic calculator to evaluate a simple expression string. The expression string may contain open ( and closing parentheses ...
[Leetcode] Summary Ranges, Solution
›
Given a sorted integer array without duplicates, return the summary of its ranges. For example, given [0,1,2,4,5,7] , return ["0-...
[Leetcode] Search a 2D Matrix II, Solution
›
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in ea...
[Leetcode] Perfect Squares, Solution
›
Given a positive integer n , find the least number of perfect square numbers (for example, 1, 4, 9, 16, ... ) which sum to n . For exa...
[Leetcode] Find Median from Data Stream, Solution
›
Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean...
[Leetcode] Remove Duplicate Letters, Solution
›
Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must mak...
[Leetcode] Maximum Product of Word Lengths, Solution
›
Given a string array words , find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters...
[Leetcode] Power of Three, Solution
›
Given an integer, write a function to determine if it is a power of three. Follow up: Could you do it without using any loop / recursion...
[Leetcode] Reverse Vowels of a String, Solution
›
Write a function that takes a string as input and reverse only the vowels of a string. Example 1: Given s = "hello", return ...
[Leetcode] Find All Numbers Disappeared in an Array, Solution
›
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...
›
Home
View web version