Marshall的专栏

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

leetcode 274. H-Index

Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index. Acc...

2016-02-29 22:51:52

阅读数:377

评论数:0

leetcode 279. Perfect Squares

Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. For example, given n = ...

2016-02-29 17:47:49

阅读数:295

评论数:0

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

2016-02-29 12:08:58

阅读数:323

评论数:0

leetcode 304. Range Sum Query 2D - Immutable

You are given an integer array nums and you have to return a new counts array. The counts array has the property where counts[i] is the number of sma...

2016-02-29 10:10:43

阅读数:317

评论数:0

leetcode 332. Reconstruct Itinerary

Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. All of the tic...

2016-02-27 20:38:01

阅读数:474

评论数:0

leetcode 306. Additive Number

Additive number is a string whose digits can form additive sequence. A valid additive sequence should contain at least three numbers. Except for...

2016-02-27 13:42:53

阅读数:519

评论数:0

leetcode 309. Best Time to Buy and Sell Stock with Cooldown

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

2016-02-26 22:42:29

阅读数:633

评论数:0

leetcode 313. Super Ugly Number

Write a program to find the nth super ugly number. Super ugly numbers are positive numbers whose all prime factors are in the given prime list prim...

2016-02-26 13:29:14

阅读数:480

评论数:0

leetcode 312. Burst Balloons

Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the balloo...

2016-02-26 09:35:16

阅读数:420

评论数:0

leetcode 316. Remove Duplicate Letters

Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure you...

2016-02-25 22:26:16

阅读数:568

评论数:0

leetcode 318. Maximum Product of Word Lengths

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. You may assu...

2016-02-24 23:05:01

阅读数:358

评论数:0

leetcode 322 Coin Change

#include "stdafx.h" #include #include #include using namespace std; class Solution { public: int coinChange(vector& coins, int amo...

2016-02-24 16:07:02

阅读数:371

评论数:0

leetcode 330. Patching Array

Given a sorted positive integer array nums and an integer n, add/patch elements to the array such that any number in range [1, n] inclusive can be fo...

2016-02-23 15:41:51

阅读数:395

评论数:0

leetcode 334. Increasing Triplet Subsequence

Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array. Formally the function should: Return true ...

2016-02-22 11:02:40

阅读数:386

评论数:0

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