码迷,mamicode.com
首页 >  
搜索关键字:digits    ( 2164个结果
Problem Sum Root to Leaf Numbers
Problem Description:Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf ...
分类:其他好文   时间:2014-07-07 16:01:34    阅读次数:223
LeetCode Plus One
class Solution {public: vector plusOne(vector &digits) { int carry = 1; int len = digits.size(); vector res; ...
分类:其他好文   时间:2014-07-06 16:43:39    阅读次数:104
HDU 4333 Revolving Digits 扩展KMP
链接:http://acm.hdu.edu.cn/showproblem.php?pid=4333 题意:给以数字字符串,移动最后若干位到最前边,统计得到的数字有多少比原来大,有多少和原来相同,有多少比原来的小。 思路:拓展KMP中的next数组标记的是子串和母串的公共前缀的长度,要将字符串长度变成原来二倍,这样如果变换后不是完全相同的数字也即公共前缀长度大于等于字符串长度,那么字母串公共前缀...
分类:其他好文   时间:2014-07-04 08:42:50    阅读次数:355
993 - Product of digits
题目:993 - Product of digits 题目大意:将一个数通过因式分解变成另一个由因子组成的最小的数。 解题思路:因为要组成数,所以因子只需要从 2 - 9,又因为需要最小的数,所以因式分解从最大的因子开始,这样位数最少,最后输出从最小的因子输出,保证最小。1的话需要特判,因为所有的数都有因子1. 代码: #include #include co...
分类:其他好文   时间:2014-07-03 18:21:51    阅读次数:155
[LeetCode] Plus One
Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at...
分类:其他好文   时间:2014-07-03 11:53:07    阅读次数:182
[leetcode] Decode Ways
Given an encoded message containing digits, determine the total number of ways to decode it.
分类:其他好文   时间:2014-07-02 14:47:02    阅读次数:217
[leetcode] Restore IP Addresses
Given a string containing only digits, restore it by returning all possible valid IP address combinations.
分类:其他好文   时间:2014-07-02 14:45:41    阅读次数:220
11198 - Dancing Digits(BFS + hash判重)
题目:11198 - Dancing Digits 题目大意:每组数据给出8个数字,可能正可能负。要求最后将这8个数字按照数字绝对值从小到大的排序。排序的规则是让某个数字a邀请另一个数字b跳舞,这样a就可以插到b的左边或是右边,a能邀请b跳舞,则a* b 解题思路:这题一开始竟然想着dfs,但是后面发现,这样的判断树可以是无限大,因为可以a邀请完b,然后b在邀请a,这样一来一...
分类:其他好文   时间:2014-07-02 11:24:12    阅读次数:160
[Leetcode]Add Two Numbers
题目 You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it a...
分类:其他好文   时间:2014-07-01 09:11:07    阅读次数:206
Repeat Number
Problem B: Repeat NumberTime Limit:1 SecMemory Limit:32 MBDescriptionDefinition: a+b = c, if all the digits of c are same ( c is more than ten),then w...
分类:其他好文   时间:2014-06-30 14:59:33    阅读次数:508
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!