由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 做题
相关主题
A家的题a problem: find local maxima in sublinear time
问个递归的问题请教个面试题
问道题: numbers of distinct substring分享经验贴
来个bit题问一个题
关于结果除掉重复的问题请教Post-order Tree Walk without marking node
generate unique integer ID from columns in SQL table请问一个关于递归算法的问题。
问个复杂度:leetcode题目 Restore IP Addresses非递归求二叉树高度,除了按层次遍历的方法,还可以怎么做?
a problem from leetcode: high efficiency algorithm for combinations problem一道二叉树的老题
相关话题的讨论汇总
话题: 27话题: numbers话题: print话题: find话题: sum
进入JobHunting版参与讨论
1 (共1页)
I**A
发帖数: 2345
1
for any integer x between 1 to 27
find 3 numbers from (0 ..9) and the sum of them equals x.
the 3 numbers need not be distinct
for instance, 5+5+5=x
r****o
发帖数: 1950
2
for i=0..9
for j=0..9
if 0<-(27-i-j)<=9 print i,j,27-i-j
有更好的方法吗?

【在 I**A 的大作中提到】
: for any integer x between 1 to 27
: find 3 numbers from (0 ..9) and the sum of them equals x.
: the 3 numbers need not be distinct
: for instance, 5+5+5=x

s******t
发帖数: 2374
3
我好像又没看清题就写了一堆东西。我删掉了呵呵。
s******t
发帖数: 2374
4
看刚才某个题目有感:
如果只要给一个答案: 查表!

【在 r****o 的大作中提到】
: for i=0..9
: for j=0..9
: if 0<-(27-i-j)<=9 print i,j,27-i-j
: 有更好的方法吗?

I**A
发帖数: 2345
5
赞,你这个很好了,2700嘛才!

【在 r****o 的大作中提到】
: for i=0..9
: for j=0..9
: if 0<-(27-i-j)<=9 print i,j,27-i-j
: 有更好的方法吗?

g**********1
发帖数: 1113
6
先把数除3,遍历result1 to 9,然后这个过程中,把(total- count)/2,遍历
result2 to count.也就是说,先确定最大的数的范围,然后确定其次大的数的范围,
然后随便遍历一下,就都出来了,可以把结果存在一个2维数组里面。
I**A
发帖数: 2345
7
写程序写程序。。

【在 g**********1 的大作中提到】
: 先把数除3,遍历result1 to 9,然后这个过程中,把(total- count)/2,遍历
: result2 to count.也就是说,先确定最大的数的范围,然后确定其次大的数的范围,
: 然后随便遍历一下,就都出来了,可以把结果存在一个2维数组里面。

s******t
发帖数: 2374
8
你们不觉得1-27这个范围太小么
表格:
1: 0, 0, 1
2: 0, 1, 1
3: 1,1,1
4: 1,1,2
5, 1, 1,3
6, 1, 1,4
。。。。。
27, 9,9,9

【在 I**A 的大作中提到】
: 写程序写程序。。
I**A
发帖数: 2345
9
童鞋,是从0-9,0呢?0呢?

【在 s******t 的大作中提到】
: 你们不觉得1-27这个范围太小么
: 表格:
: 1: 0, 0, 1
: 2: 0, 1, 1
: 3: 1,1,1
: 4: 1,1,2
: 5, 1, 1,3
: 6, 1, 1,4
: 。。。。。
: 27, 9,9,9

s******t
发帖数: 2374
10
faint。我该睡觉了。我洗洗睡了

【在 I**A 的大作中提到】
: 童鞋,是从0-9,0呢?0呢?
相关主题
generate unique integer ID from columns in SQL tablea problem: find local maxima in sublinear time
问个复杂度:leetcode题目 Restore IP Addresses请教个面试题
a problem from leetcode: high efficiency algorithm for combinations problem分享经验贴
进入JobHunting版参与讨论
I**A
发帖数: 2345
11
wave~~~

【在 s******t 的大作中提到】
: faint。我该睡觉了。我洗洗睡了
m****n
发帖数: 589
12
可不可以递归?然后用一个global的数组?

【在 I**A 的大作中提到】
: for any integer x between 1 to 27
: find 3 numbers from (0 ..9) and the sum of them equals x.
: the 3 numbers need not be distinct
: for instance, 5+5+5=x

s******t
发帖数: 2374
13
随便举个例子。
18 = 9+9+0
18 = 9+8+1
18 = 9+7+2
题目的要求是什么,是需要listout每个可能性么?
g*****t
发帖数: 42
14
print x/3, (x+1)/3, (x+2)/3
I**A
发帖数: 2345
15
nod, all combination
the original question is this one
"Find all numbers in the range 1...999999, where the sum of first 3 digits are same as last three digits"

【在 s******t 的大作中提到】
: 随便举个例子。
: 18 = 9+9+0
: 18 = 9+8+1
: 18 = 9+7+2
: 题目的要求是什么,是需要listout每个可能性么?

I**A
发帖数: 2345
16
请问大家
这道题
除了分解1-27之间任何一个数成三个数(0-9)之外
有没有别的好办法?

are same as last three digits"

【在 I**A 的大作中提到】
: nod, all combination
: the original question is this one
: "Find all numbers in the range 1...999999, where the sum of first 3 digits are same as last three digits"

1 (共1页)
进入JobHunting版参与讨论
相关主题
一道二叉树的老题关于结果除掉重复的问题请教
抽空简单说一下昨天的Google Phone Interviewgenerate unique integer ID from columns in SQL table
感恩发面经-Amazon第二轮电面问个复杂度:leetcode题目 Restore IP Addresses
A家一道onsite题a problem from leetcode: high efficiency algorithm for combinations problem
A家的题a problem: find local maxima in sublinear time
问个递归的问题请教个面试题
问道题: numbers of distinct substring分享经验贴
来个bit题问一个题
相关话题的讨论汇总
话题: 27话题: numbers话题: print话题: find话题: sum