wxliuyizhe
BAN USER
Comments (4)
Reputation 35
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 2 vote
Can I ask a question? What if the point is (0, 0) , and Area is 2?
I think based on your algorithm, the results should be
(0,1), (1,2), (2, 0),
(1,0), (0,2), (2, 1),
etc.
But should (1,1) ,( -1, -1), (0,2) be a valid pair ?
Comment hidden because of low score. Click to expand.
0
of 0 vote
I see. Thx.
- wxliuyizhe October 13, 2014Comment hidden because of low score. Click to expand.
0
of 0 vote
Any constraint on the number of digits? Since infinite valid numbers can be generated with only start number and end number. For example, if s = 2 , e = 5 then
2345, 234345, 23434345, 2343434345, .......
Do I misunderstand this question?
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
Based on Sieve of Eratosthenes to find out all the all the primes smaller than input number n, and traverse these primes, while a hash set to store the complementary numbers, once one valid complementary traversed, just return this pair.
- wxliuyizhe October 17, 2014