Marshall的专栏

一旦把问题想清楚,代码是水到渠成的事,所以首先是思考,思考,思考

leetcode 31. Next Permutation

Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not po...

2016-03-31 23:05:57

阅读数:256

评论数:0

leetcode 46. Permutations

Given a collection of distinct numbers, return all possible permutations. For example, [1,2,3] have the following permutations: [1,2,3], [1,3,2]...

2016-03-31 21:35:36

阅读数:291

评论数:0

leetcode 275. H-Index II

What if the citations array is sorted in ascending order? Could you optimize your algorithm? int hIndex(int* citations, int citationsSiz...

2016-03-31 20:26:22

阅读数:307

评论数:0

leetcode 122. Best Time to Buy and Sell Stock II

Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may co...

2016-03-31 16:20:00

阅读数:233

评论数:0

leetcode 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 transac...

2016-03-31 15:42:41

阅读数:276

评论数:0

leetcode 227. Basic Calculator II

Implement a basic calculator to evaluate a simple expression string. The expression string contains only non-negative integers, +, -, *, / operato...

2016-03-31 14:07:40

阅读数:257

评论数:0

leetcode 224. Basic Calculator

Implement a basic calculator to evaluate a simple expression string. The expression string may contain open ( and closing parentheses ), the plu...

2016-03-31 11:43:32

阅读数:287

评论数:0

leetcode 42. 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...

2016-03-30 11:46:13

阅读数:306

评论数:0

leetcode 150. Evaluate Reverse Polish Notation

Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each operand may be an integer or anothe...

2016-03-30 00:07:36

阅读数:283

评论数:0

leetcode 43. Multiply Strings

Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can be arbitrarily large and are non...

2016-03-30 00:07:23

阅读数:295

评论数:0

leetcode 3. Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters...

2016-03-29 13:52:41

阅读数:228

评论数:0

leetcode 91. Decode Ways

A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given ...

2016-03-29 11:19:19

阅读数:343

评论数:0

leetcode 93. Restore IP Addresses

Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example: Given "25525511135&q...

2016-03-29 09:48:48

阅读数:291

评论数:0

leetcode 74. Search a 2D Matrix

Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are ...

2016-03-28 21:47:51

阅读数:267

评论数:0

leetcode 300. Longest Increasing Subsequence

Given an unsorted array of integers, find the length of longest increasing subsequence. For example, Given [10, 9, 2, 5, 3, 7, 101, 18], The lon...

2016-03-28 15:34:08

阅读数:269

评论数:0

leetcode 48. Rotate Image

You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up: Could you do this in-place? ...

2016-03-28 13:23:41

阅读数:281

评论数:0

leetcode 213. House Robber II

After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This ...

2016-03-28 10:23:00

阅读数:308

评论数:0

leetcode 198. House Robber

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping y...

2016-03-27 23:09:59

阅读数:264

评论数:0

leetcode 77. Combinations

Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example, If n = 4 and k = 2, a solution is: [ [2,4],...

2016-03-27 22:01:22

阅读数:225

评论数:0

leetcode 94. Binary Tree Inorder Traversal

Given a binary tree, return the inorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3 ...

2016-03-27 22:00:58

阅读数:218

评论数:0

提示
确定要删除当前文章?
取消 删除
关闭
关闭