Marshall的专栏

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

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

find shorttest path

def find_shortest_path(maze): ''' maze = [['X', 'X', 'O', 'S', 'X'], ['X', 'X', 'O', 'O', 'X'], ['X', 'X', 'O', '...

2019-03-08 17:57:15

阅读数 11

评论数 0

LeetCode interval section

class Solution(object): def intervalIntersection(self, A, B): """ :type A: List[Interval] :typ...

2019-03-08 17:55:32

阅读数 7

评论数 0

LeetCode maximum binary tree

# Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None se...

2019-03-08 17:53:48

阅读数 18

评论数 0

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

阅读数 525

评论数 0

排序算法总结

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

2016-04-30 11:33:13

阅读数 438

评论数 0

动态规划问题之一马当先

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

2016-04-28 22:52:07

阅读数 982

评论数 0

pat 1087

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

2016-04-21 15:11:17

阅读数 368

评论数 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

阅读数 623

评论数 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

阅读数 512

评论数 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

阅读数 358

评论数 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

阅读数 397

评论数 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

阅读数 379

评论数 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

阅读数 349

评论数 0

网易2016研发工程师编程题

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

2016-04-18 14:03:52

阅读数 510

评论数 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

阅读数 1073

评论数 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

阅读数 422

评论数 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

阅读数 452

评论数 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

阅读数 510

评论数 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

阅读数 492

评论数 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

阅读数 440

评论数 0

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