Marshall的专栏

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

排序:
默认
按更新时间
按访问量

leetcode 357. Count Numbers with Unique Digits

Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x n. Example: Given n = 2, return 91. (The answer should be the ...

2016-06-21 21:33:42

阅读数:520

评论数:0

排序算法总结

简单选择排序 基本思想: 在要排序的一组数中,选出最小(或者最大)的一个数与第1个位置的数交换;然后在剩下的数当中再找最小(或者最大)的与第2个位置的数交换,依次类推,直到第n-1个元素(倒数第二个数)和第n个元素(最后一个数)比较为止。 li=[3,5,1,3,6,9,2,3,8,0,8...

2016-04-30 11:33:13

阅读数:427

评论数:0

动态规划问题之一马当先

下过象棋的人都知道,马只能走'日'字形(包括旋转90°的日),现在想象一下,给你一个n行m列网格棋盘, 棋盘的左下角有一匹马,请你计算至少需要几步可以将它移动到棋盘的右上角,若无法走到,则输出-1. 如n=1,m=2,则至少需要1步;若n=1,m=3,则输出-1。 board = [[-1...

2016-04-28 22:52:07

阅读数:933

评论数:0

pat 1087

1087. All Roads Lead to Rome (30) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHE...

2016-04-21 15:11:17

阅读数:356

评论数:0

leetcode 343. Integer Break

Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum pr...

2016-04-20 11:43:13

阅读数:616

评论数:0

leetcode 336. Palindrome Pairs

Given a list of unique words. Find all pairs of distinct indices (i, j) in the given list, so that the concatenation of the two words, i.e. words[i]...

2016-04-20 10:52:11

阅读数:496

评论数:0

leetcode 123. Best Time to Buy and Sell Stock III

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-04-19 13:18:36

阅读数:351

评论数:0

leetcode 310. Minimum Height Trees

For a undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted tree. Among all possible root...

2016-04-18 22:12:14

阅读数:390

评论数:0

leetcode 63. Unique Paths II

Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. How many unique paths would there be? An obstacl...

2016-04-18 20:58:18

阅读数:372

评论数:0

leetcode 134. Gas Station

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

2016-04-18 20:09:32

阅读数:339

评论数:0

网易2016研发工程师编程题

一个小时,三道题。 小易经常沉迷于网络游戏.有一次,他在玩一个打怪升级的游戏,他的角色的初始能力值为 a.在接下来的一段时间内,他将会依次遇见n个怪物,每个怪物的防御力为b1,b2,b3...bn. 如果遇到的怪物防御力bi小于等于小易的当前能力值c,那么他就能轻松打败怪物,并 ...

2016-04-18 14:03:52

阅读数:503

评论数:0

leetcode 341. Flatten Nested List Iterator

Given a nested list of integers, implement an iterator to flatten it. Each element is either an integer, or a list -- whose elements may also be i...

2016-04-17 22:13:32

阅读数:1058

评论数:0

leetcode 89. Gray Code

The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the total...

2016-04-17 20:59:28

阅读数:412

评论数:0

leetcode 65. Valid Number

Validate if a given string is numeric. Some examples: "0" => true " 0.1 " => true "abc" => false "...

2016-04-16 11:58:18

阅读数:442

评论数:0

leetcode 10. Regular Expression Matching

Implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches zero or more of the preceding elem...

2016-04-15 22:15:08

阅读数:503

评论数:0

leetcode 135. Candy

There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following ...

2016-04-14 16:12:36

阅读数:483

评论数:0

leetcode 101. Symmetric Tree

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: 1 ...

2016-04-13 16:42:04

阅读数:428

评论数:0

蘑菇街2016校招算法题

Arthur最近搬到了新的别墅,别墅特别大,原先的桌子显得比较小,所以他决定换一张新的桌子。他买了一张特别大的桌子,桌子是由很多条桌腿进行支撑的,可是回到家之后他发现桌子不稳,原来是桌子腿长度不太相同。他想要自己把桌子修理好,所以他决定移除掉一些桌腿来让桌子变得平稳。桌子腿总共有n条腿,第i条腿长...

2016-04-13 14:48:26

阅读数:1282

评论数:0

网易2016实习研发笔试

小明陪小红去看钻石,他们从一堆钻石中随机抽取两颗并比较她们的重量。这些钻石的重量各不相同。在他们们比较了一段时间后,它们看中了两颗钻石g1和g2。现在请你根据之前比较的信息判断这两颗钻石的哪颗更重。 给定两颗钻石的编号g1,g2,编号从1开始,同时给定关系数组vector,其中元素为一些二元组,...

2016-04-12 22:45:15

阅读数:2096

评论数:2

leetcode 165. Compare Version Numbers

Compare two version numbers version1 and version2. If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0. You ma...

2016-04-12 17:18:57

阅读数:464

评论数:0

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