- 博客(48)
- 收藏
- 关注
原创 leetcode:Decode Ways
A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine the total numb
2014-11-06 22:20:56 539
原创 leetcode:
Subsets II Total Accepted: 21377 Total Submissions: 79102My SubmissionsQuestion Solution Given a collection of integers that might contain duplicates, S, return all possible subs
2014-11-06 20:27:33 576
原创 leetcode:Subsets
Given a set of distinct integers, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.For exa
2014-11-06 19:40:35 502
原创 leetcode:Reverse Linked List II
Reverse a linked list from position m to n. Do it in-place and in one-pass.For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->2->5->NULL.Note:Given m, n satisfy the
2014-11-05 19:50:54 436
原创 leetcode:Restore IP Addresses
Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given "25525511135",return ["255.255.11.135", "255.255.111.35"]. (Order do
2014-11-05 15:09:24 536
原创 leetcode: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 / 3return [1,3,2].Note: Recursive solutio
2014-11-05 13:14:46 575
原创 leetcode:Unique Binary Search Trees II
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.For example,Given n = 3, your program should return all 5 unique BST's shown below. 1 3
2014-11-04 22:06:53 453
原创 leetcode:Unique Binary Search Trees
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1 \
2014-11-04 21:18:31 401
原创 leetcode:Interleaving String
Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example,Given:s1 = "aabcc",s2 = "dbbca",When s3 = "aadbbcbcac", return true.When s3 = "aadbbbaccc", ret
2014-11-04 20:33:21 446
原创 leetcode:Validate Binary Search Tree
Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node's key.The
2014-10-29 16:13:57 450
原创 leetcode:Pascal's Triangle
Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]Hide Tags Array
2014-10-22 21:28:44 445
原创 leetcode:Triangle
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2], [3,4], [6,
2014-10-22 21:23:22 433
原创 leetcode: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 transaction (ie, buy one and sell one share of the stock), d
2014-10-22 21:05:27 439
原创 leetcode: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 complete as many transactions as you like (ie, buy one
2014-10-22 21:03:09 610
原创 Stanford机器学习课程-week1-Introduction & Linear Regression
Stanford机器学习课程-week1-Introduction & Linear RegressionDefinitionArthur Samuel (1959). Machine Learning: Field of study that gives computers the ability to learn without being explicitly programme
2014-09-28 21:00:08 760
原创 leetcode:Longest Consecutive Sequence
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is [1, 2, 3
2014-09-17 09:48:35 548
原创 leetcode:Sum Root to Leaf Numbers
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number 123.Find the tota
2014-09-16 17:07:26 471
原创 leetcode:Surrounded Regions
Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region.For example,X X X XX O O X
2014-09-16 17:04:27 511
原创 leetcode:Clone Gragh
题目:https://oj.leetcode.com/problems/clone-graph/Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ's undirected graph serialization:Nodes a
2014-09-13 15:10:29 622
原创 leetcode:Gas Station
题目:https://oj.leetcode.com/problems/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
2014-09-12 17:48:10 685
原创 leetcode:candy
题目:https://oj.leetcode.com/problems/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 req
2014-09-12 10:39:03 488
原创 leetcode:Word Break II
Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word.Return all such possible sentences.For example, givens = "
2014-09-11 17:10:05 549
原创 leetcode:Word Break
题目:https://oj.leetcode.com/problems/word-break/Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.
2014-09-11 16:48:15 459
原创 leetcode:Palindrome Partitioning II
Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning of s.For example, given s = "aab",Return
2014-09-11 16:38:26 471
原创 leetcode:Palindrome Partitioning
Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = "aab",Return [ ["aa","
2014-09-11 16:22:11 455
转载 程序员技术练级攻略
月光博客6月12日发表了《写给新手程序员的一封信》,翻译自《An open letter to those who want to start programming》,我的朋友(他在本站的id是Mailper)告诉我,他希望在酷壳上看到一篇更具操作性的文章。因为他也是喜欢编程和技术的家伙,于是,我让他把他的一些学习Python和Web编程的一些点滴总结一下。于是他给我发来了一些他的心得和经历
2014-09-09 09:05:51 453
原创 python装饰器简单入门
最近在看OpenStack源代码的时候看到装饰器的使用,以前没有遇到过,所以学习一下,顺便记录一下。装饰器的作用:装饰器就是把函数包装一下,为函数添加一些附加功能,装饰器就是一个函数,参数为被包装的函数,返回包装后的函数装饰器用法示例:1,没有参数的装饰器没有参数的装饰器会直接接受原函数作为参数,定义如下:
2014-08-05 10:07:50 522
原创 求拓扑序列
题目描述:ACM-DIY is a large QQ group where many excellent acmers get together. It is so harmonious that just like a big family. Every day,many "holy cows" like HH, hh, AC, ZT, lcc, BF, Qinz and so on
2014-04-17 21:42:09 9637
原创 求最短路径
九度1447题目描述:在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗?输入:输入包括多组数据。每组数据第一行是两个整数N、M(N当输入为两个0时,输入结束。输出:对于每组输入,输出一行,表
2014-04-14 15:38:50 1058
原创 最小生成树
#include#include#includeusing namespace std;#define N 101int root[N];struct Road{int v1;//村庄1 int v2;//村庄2 int cost;//连接村庄1和村庄2的cost bool operator return cost }};
2014-04-09 16:52:23 1183
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人