Redian新闻
>
Seller agent不肯告诉为什么卖房的原因为什么呢?
avatar
Seller agent不肯告诉为什么卖房的原因为什么呢?# Living
m*o
1
A non-empty zero-indexed array A consisting of N integers is given. A pair
of integers (P, Q) is called K-complementary in array A if 0 = P, Q < N and
A[P] + A[Q] = K.
For example, consider array A such that
A[0] = 1 A[1] = 8 A[2]= -3
A[3] = 0 A[4] = 1 A[5]= 3
A[6] = -2 A[7] = 4 A[8]= 5
1,8,-3,0,1,3,-2,4,5
The following pairs are 6-complementary in array A: (0,8), (1,6), (4,8), (5,
5), (6,1), (8,0), (8,4). For instance, the pair (4,8) is 6-complementary
because A[4] + A[8] = 1 + 5 = 6.
Write a function
class Solution { public int complementary_pairs(int K,int[] A); }
that, given an integer K and a non-empty zero-indexed array A consisting of
N integers, returns the number of K-complementary pairs in array A.
Assume that:
N is an integer within the range [1..50,000];
K is an integer within the range [-2,147,483,648..2,147,483,647];
-2147483648
2147483647
each element of array A is an integer within the range [-2,147,483,648..2,
147,483,647].
For example, given K = 6 and array A such that
A[0] = 1 A[1] = 8 A[2]= -3
A[3] = 0 A[4] = 1 A[5]= 3
A[6] = -2 A[7] = 4 A[8]= 5
the function should return 7, as explained above.
Complexity:
expected worst-case time complexity is O(N*log(N));
expected worst-case space complexity is O(N), beyond input storage (not
counting the storage required for input arguments).
Elements of input arrays can be modified.
In order to get the best score in the exercise, please read the information
below:
- Your code must compile. Failure to do so will yield a score of 0.
- Your algorithm must pass the *time* and *space* complexity indicated in
the programming exercise.
- Your score on the exercise is based on your algorithm being able to pass
the following the test cases:
- example1: example test
- extreme_all_equal: 4 equals elements (multiple runs)
- extreme_big_ints: big values (multiple runs)
- extreme_single: 1-element sequence (multiple runs)
- medium1: random array of size 1000
- medium1: random array of size 2000
- big1: random array of size 20000
- big2: random array of size 30000
- big3: random array of size 40000

Recommendations:
- Use the testing feature extensively to verify your algorithm against the
test cases above
avatar
h*a
2
H1B 用3年了, 需要renew.
先跟公司律师联系或HR联系?
大家怎么renew的?
avatar
a*e
3
我们问seller为什么要卖房的时候,seller agent说她不能disclose,问她是不是不知
道原因,她说她知道但她not supposed to disclose这个原因,为什么呢?会有什么蹊
跷吗?
avatar
m*o
4
是否太简单了?

and
5,

【在 m***o 的大作中提到】
: A non-empty zero-indexed array A consisting of N integers is given. A pair
: of integers (P, Q) is called K-complementary in array A if 0 = P, Q < N and
: A[P] + A[Q] = K.
: For example, consider array A such that
: A[0] = 1 A[1] = 8 A[2]= -3
: A[3] = 0 A[4] = 1 A[5]= 3
: A[6] = -2 A[7] = 4 A[8]= 5
: 1,8,-3,0,1,3,-2,4,5
: The following pairs are 6-complementary in array A: (0,8), (1,6), (4,8), (5,
: 5), (6,1), (8,0), (8,4). For instance, the pair (4,8) is 6-complementary

avatar
h*a
5


【在 h****a 的大作中提到】
: H1B 用3年了, 需要renew.
: 先跟公司律师联系或HR联系?
: 大家怎么renew的?

avatar
k*n
6
这没什么不对的,可能涉及隐私。你只要问房子的问题,他知道一定要disclosed.
avatar
z*u
7
请问这个是 Java 么?
class Solution { public int complementary_pairs(int K,int[] A); }
C++ 的话,直接传 int[] A 的话,得不到 array 的长度信息吧?
avatar
T*y
8
How did you get your H1 in the first place? You should know who takes care
of such things in your company.

【在 h****a 的大作中提到】
: H1B 用3年了, 需要renew.
: 先跟公司律师联系或HR联系?
: 大家怎么renew的?

avatar
az
9
我家买的时候,人家也不说,反正是Personal原因就是了,我们从头至尾没见过卖主

【在 a****e 的大作中提到】
: 我们问seller为什么要卖房的时候,seller agent说她不能disclose,问她是不是不知
: 道原因,她说她知道但她not supposed to disclose这个原因,为什么呢?会有什么蹊
: 跷吗?

avatar
m*o
10
语言不限,java, c#, php,, c++都可以,那个只是一个示范.

【在 z****u 的大作中提到】
: 请问这个是 Java 么?
: class Solution { public int complementary_pairs(int K,int[] A); }
: C++ 的话,直接传 int[] A 的话,得不到 array 的长度信息吧?

avatar
M*s
11
Based on my experience, talk to your director first and ask him/her to
contact HR to start the procedure. The HR should prepare necessary documents
and contact the lawyer. Generally, you can not do this by yourself.
avatar
l*u
12
disclose上面有屋主姓名,google试试?you might find some surprise..

【在 a****e 的大作中提到】
: 我们问seller为什么要卖房的时候,seller agent说她不能disclose,问她是不是不知
: 道原因,她说她知道但她not supposed to disclose这个原因,为什么呢?会有什么蹊
: 跷吗?

avatar
z*u
13
先排序,时间 O(nlgn),空间 O(n) 都可以做到
排序之后,再搜索可能的 pair,从首尾两端扫描,永远不用回头扫,所以时间应该是
O(n)
这样总共的时间是 O(nlgn),空间 depends,但不会超过 O(n)
avatar
p*h
14
我直接和老板谈,然后同意之后就找HR的immigration officer办就可以了。
avatar
n*9
15
That's personal info. agents do not have legal right to disclose any
personal info.

【在 a****e 的大作中提到】
: 我们问seller为什么要卖房的时候,seller agent说她不能disclose,问她是不是不知
: 道原因,她说她知道但她not supposed to disclose这个原因,为什么呢?会有什么蹊
: 跷吗?

avatar
m*o
16
排序o(nlgn)+搜索0(n)= o(nlgn)? 好像不是很优的办法吧



【在 z****u 的大作中提到】
: 先排序,时间 O(nlgn),空间 O(n) 都可以做到
: 排序之后,再搜索可能的 pair,从首尾两端扫描,永远不用回头扫,所以时间应该是
: O(n)
: 这样总共的时间是 O(nlgn),空间 depends,但不会超过 O(n)

avatar
K*S
17
这个问题有什么用呢?人家随便编一个,你什么信息都得不到

【在 a****e 的大作中提到】
: 我们问seller为什么要卖房的时候,seller agent说她不能disclose,问她是不是不知
: 道原因,她说她知道但她not supposed to disclose这个原因,为什么呢?会有什么蹊
: 跷吗?

avatar
m*o
18
两层循环逐一递减应该比较快吧

and
5,

【在 m***o 的大作中提到】
: A non-empty zero-indexed array A consisting of N integers is given. A pair
: of integers (P, Q) is called K-complementary in array A if 0 = P, Q < N and
: A[P] + A[Q] = K.
: For example, consider array A such that
: A[0] = 1 A[1] = 8 A[2]= -3
: A[3] = 0 A[4] = 1 A[5]= 3
: A[6] = -2 A[7] = 4 A[8]= 5
: 1,8,-3,0,1,3,-2,4,5
: The following pairs are 6-complementary in array A: (0,8), (1,6), (4,8), (5,
: 5), (6,1), (8,0), (8,4). For instance, the pair (4,8) is 6-complementary

avatar
g*k
19
不能这末绝对。有时候还是有用的。我们现在买的房子,房主已经搬到别处去住了,这
个房子基本上空着还在交税,砍价的时候会比较有底。

【在 K******S 的大作中提到】
: 这个问题有什么用呢?人家随便编一个,你什么信息都得不到
avatar
g*s
20
hashmap + one scan is enough for this question.
time O(n) + space O(n)
avatar
s*d
21
这。。。agent不告诉你你是不是就看不出来房子是空着得了?
是不是也想不到房主还要交税?

【在 g*****k 的大作中提到】
: 不能这末绝对。有时候还是有用的。我们现在买的房子,房主已经搬到别处去住了,这
: 个房子基本上空着还在交税,砍价的时候会比较有底。

avatar
g*k
22
家里伸末都有,一应俱全,谁知道已经没人住了。昨天home inspection再去看就把家
具什末的搬走了。

【在 s**********d 的大作中提到】
: 这。。。agent不告诉你你是不是就看不出来房子是空着得了?
: 是不是也想不到房主还要交税?

avatar
K*S
23
then you need to know whether the owner has new employer, whether that new
employer is responsible for relocation or not. If a relocation company is
handling the sale, you won't get any bargaining power compared with local
sellers.

【在 g*****k 的大作中提到】
: 不能这末绝对。有时候还是有用的。我们现在买的房子,房主已经搬到别处去住了,这
: 个房子基本上空着还在交税,砍价的时候会比较有底。

avatar
q*z
24
屋主不愿意说吧,所以让agent不说.无所谓吧
看房子本身就好了.

【在 a****e 的大作中提到】
: 我们问seller为什么要卖房的时候,seller agent说她不能disclose,问她是不是不知
: 道原因,她说她知道但她not supposed to disclose这个原因,为什么呢?会有什么蹊
: 跷吗?

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。