问题描述Ugly number is a number that only have factors 3, 5 and 7.Design an algorithm to find the Kth ugly number. The first 5 ugly numbers are 3, 5, 7, 9, 15 …问题分析这个题,有多种方法求解,常见的是有辅助数据结构,比如priority_queue,...
分类:
其他好文 时间:
2015-07-06 01:32:42
阅读次数:
533
Linux命令总结—cat命令(1)命令功能cat命令用于将多个文件连接,并将结果通过标准输出显示出来。(2)命令语法cat(选项)(参数)(3)选项说明-n或-number:由1开始对所有输出的行数编号;-b或—number-nonblank:和-n相似,只不过对于空白行不编号;-s或—squeeze-blank:当遇..
分类:
系统相关 时间:
2015-07-06 00:09:45
阅读次数:
230
Problem Description
Now you are back,and have a task to do:
Given you a string s consist of lower-case English letters only,denote f(s) as the number of distinct sub-string of s.
And you have som...
分类:
编程语言 时间:
2015-07-05 23:58:10
阅读次数:
557
Problem Description
Life is a game,and you lose it,so you suicide.
But you can not kill yourself before you solve this problem:
Given you a sequence of number a1, a2, ..., an.They are also a perm...
分类:
其他好文 时间:
2015-07-05 23:58:03
阅读次数:
376
1. Two SumGiven an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of ...
分类:
其他好文 时间:
2015-07-05 19:49:25
阅读次数:
93
Area of a CircleDescription:Complete the functioncircleAreaso that it will return the area of a circle with the givenradius. Round the returned number...
分类:
其他好文 时间:
2015-07-05 18:25:40
阅读次数:
134
题目:输入一个正整数数组,把数组里所有数字拼接起来排成一个数,打印能拼接出的所有数字中最小的一个。例如输入数组{3,32,321},则打印出这3个数字能排成的最小数字321323.参见LeetCode-Largest Number。
分类:
编程语言 时间:
2015-07-05 18:16:56
阅读次数:
107
【称号】Given a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is formed from the ...
分类:
其他好文 时间:
2015-07-05 18:15:17
阅读次数:
93
在JavaScript中,有5种基本数据类型和1种复杂数据类型,基本数据类型有:Undefined, Null, Boolean, Number和String;复杂数据类型是Object,Object中还细分了很多具体的类型,比如:Array, Function, Date等等。今天我们就来探讨一下,使用什么方法判断一个出一个变量的类型。 在讲解各种方法之前,我们首先定义出几个测试变量,看看后面的...
分类:
编程语言 时间:
2015-07-05 15:06:59
阅读次数:
142
Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer...
分类:
移动开发 时间:
2015-07-05 14:53:40
阅读次数:
127