由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 请教一个数论的问题
相关主题
Google电话面试题目Given an int array and an int value. Find all pairs in arr
Given an array of N integers from range [0, N] and one is missing. Find the missing number.这个怎么弄?
问一道面试题目问个面试题
问一道题问一道老题
一道面试题请教一个题目
Zenefits面经(已挂)请教一道L的题
请教一道题目求问一个题
问一个面试题彭博 面试题
相关话题的讨论汇总
话题: a1话题: b1话题: a2话题: bn话题: b2
进入JobHunting版参与讨论
1 (共1页)
l***i
发帖数: 1309
1
two integer array:
a1, a2, ..., an
b1, b2, ..., bn
Given a1 + a2 + ... + an = b1 + b2 + ... + bn
and a1^2 + a2^2 + ... + an^2 = b1^2 + b2^2 + ... + bn
and a1 <= a2 <= ... <= an
b1 <= b2 <= ... <= bn
Is it true that
a1 = b1, a2 = b2, ... an = bn?
h***t
发帖数: 2540
2
NO
s****r
发帖数: 11
3
Can you elaborate a little more? Thanks.

【在 h***t 的大作中提到】
: NO
l***i
发帖数: 1309
4
If you said no, give an example or an existence proof.
If yes, say something about proof ideas.
p*********9
发帖数: 30
5
Yes, a1=b1.
suppose a1+t=b1 where t>0
=> a2-t=b2, with a1^2 + a2^2 = b1^2 + b2^2
=> t=a2-a1
with the assumption a1+t=b1 => a2=b1 => a1=b2
so it's conflict with a1 done!

【在 l***i 的大作中提到】
: two integer array:
: a1, a2, ..., an
: b1, b2, ..., bn
: Given a1 + a2 + ... + an = b1 + b2 + ... + bn
: and a1^2 + a2^2 + ... + an^2 = b1^2 + b2^2 + ... + bn
: and a1 <= a2 <= ... <= an
: b1 <= b2 <= ... <= bn
: Is it true that
: a1 = b1, a2 = b2, ... an = bn?

r*****r
发帖数: 630
6
the last term on the right hand side of the second equation is bn^2 or bn?

【在 l***i 的大作中提到】
: two integer array:
: a1, a2, ..., an
: b1, b2, ..., bn
: Given a1 + a2 + ... + an = b1 + b2 + ... + bn
: and a1^2 + a2^2 + ... + an^2 = b1^2 + b2^2 + ... + bn
: and a1 <= a2 <= ... <= an
: b1 <= b2 <= ... <= bn
: Is it true that
: a1 = b1, a2 = b2, ... an = bn?

s*x
发帖数: 3328
7
one counter-example, for example:
0^2+3^2+5^2+6^2+9^2+10^2+12^2+15^2
=620
=1^2+2^2+4^2+7^2+8^2+11^2+13^2+14^2

【在 l***i 的大作中提到】
: two integer array:
: a1, a2, ..., an
: b1, b2, ..., bn
: Given a1 + a2 + ... + an = b1 + b2 + ... + bn
: and a1^2 + a2^2 + ... + an^2 = b1^2 + b2^2 + ... + bn
: and a1 <= a2 <= ... <= an
: b1 <= b2 <= ... <= bn
: Is it true that
: a1 = b1, a2 = b2, ... an = bn?

p*****n
发帖数: 368
8
so easy ah,
3^2+4^2=0^2+5^2

【在 l***i 的大作中提到】
: If you said no, give an example or an existence proof.
: If yes, say something about proof ideas.

p*****n
发帖数: 368
9
...

【在 p*********9 的大作中提到】
: Yes, a1=b1.
: suppose a1+t=b1 where t>0
: => a2-t=b2, with a1^2 + a2^2 = b1^2 + b2^2
: => t=a2-a1
: with the assumption a1+t=b1 => a2=b1 => a1=b2
: so it's conflict with a1: done!

p*********9
发帖数: 30
10
but 3+4 != 0+5

【在 p*****n 的大作中提到】
: so easy ah,
: 3^2+4^2=0^2+5^2

1 (共1页)
进入JobHunting版参与讨论
相关主题
彭博 面试题一道面试题
Search in a sorted, rotated listZenefits面经(已挂)
问个google面试题请教一道题目
一道面试题看不懂问一个面试题
Google电话面试题目Given an int array and an int value. Find all pairs in arr
Given an array of N integers from range [0, N] and one is missing. Find the missing number.这个怎么弄?
问一道面试题目问个面试题
问一道题问一道老题
相关话题的讨论汇总
话题: a1话题: b1话题: a2话题: bn话题: b2