Live data from Hacker News

Hiring the Smartest People in the World

blog.tanyakhovanova.com

11–20 of 66 posts

Re: Hiring the Smartest People in the World

#11

A quick Google will find you the answer to the first question. The second just requires an additional equation, where people are suggesting powers in finite groups. This seems rather complex. Can we not reach the same constraints by only summing the even numbers, for instance?

1°: s is the sum of the numbers in the array, x = n(n+1)/2-s

2°: s sum, p product, solve the linear system {n(n+1)/2-x+y=s; n!y = px}

Re: Hiring the Smartest People in the World

#12
post #11

A quick Google will find you the answer to the first question. The second just requires an additional equation, where people are suggesting powers in finite groups. This seems rather complex. Can we not reach the same constraints by only summing the even numbers, for instance?

1°: s is the sum of the numbers in the array, x = n (n+1)/2-s 2°: s sum, p product, solve the linear system {n (n+1)/2-x+y=s; n! y = p x}

Sorry, can you expand on what you meant by that?

Re: Hiring the Smartest People in the World

#13
I used to work at a company inordinately full of extremely smart people. The issue there was the lack of absolutely competent but not stellar thinkers - the people to do the grunt work. I'm convinced that in most engineering companies you need a good mix, biased towards the competent types.

Re: Hiring the Smartest People in the World

#14

A quick Google will find you the answer to the first question. The second just requires an additional equation, where people are suggesting powers in finite groups. This seems rather complex. Can we not reach the same constraints by only summing the even numbers, for instance?

At the very least, you could do it with logs like so:

    >>> from math import exp, log
    >>> ref  = [i for i in range(1, 500000)]
    >>> test = [i if i != 7922 else 59148 for i in ref]
    >>> s = sum(test) - sum(ref)
    >>> r = exp(sum(map(log, test)) - sum(map(log, ref)))
    >>> b = s/(r - 1); b
    7921.999994157095
    >>> (int(round(b)), s + int(round(b)))
    (7922, 59148)
The use of logs is really just a convenience for finding product(test) and product(ref), so that we have both a - b (from the sums) and a/b (from the ratio of the products).

Python of course has bignums, so we can also calculate these products directly, but that gets to be a very large calculation; you don't want to be storing N! for N ~= 2^64 if at all possible.

If we know that these numbers are bounded by 2^n (e.g. they're all longs) then we might be able to do this product modulo some larger base, perhaps even 2^n, with the assurance that when we do the division all of that crap will cancel; I don't know and haven't tried it.

Re: Hiring the Smartest People in the World

#15
Solution to problem 1: summing the numbers and then subtracting the sum from 1 + 2 + 3 + ... + n gives the deleted number x.

Solution to problem 2: let x be the deleted number and let y be the duplicated number. Summing the numbers and subtracting the sum from 1 + 2 + 3 + ... + n gives x - y.

Xor-ing the numbers and xor-ing the result with (1 xor 2 xor 3 xor ... xor n) gives x xor y. Now x xor y (expressed as a binary string) must contain at least one 1. So there is some digit where the binary representation of x differs from the binary representation of y. Let this digit be the ith digit.

Let's say that a number is good if the ith digit of its binary representation is a 1. Let's call numbers that aren't good bad. Observe that exactly one of x, y is good, and the other one is bad.

Let S be the number that we get by doing this:

  S = 0

  for j in 1..n:

    if j is good: S = S + j

    if j is bad: S = S - j
Let T be the number that we get by doing this:

  T = 0

  for j in our_list_of_numbers:

    if j is good: T = T + j

    if j is bad: T = T - j
We find that S - T = x + y or -(x + y). Since x + y is positive, we can find x + y in either case.

We have x + y and x - y, so we can find x and y.

Solution to problem 3: imagine that we have a car, car 1, that has a really big tank with a bunch of gas in it. Put car 1 somewhere on the track and have it drive one complete revolution. The amount of gas G in the tank of car 1 varies over time, but at some point P on the track, G reaches its minimum value. P has to be at a gas station. (Otherwise G would be lower at a point right in front of P.)

If we take our regular car and start it (with an empty tank) at point P, it's pretty easy to see that it'll make it all the way around the loop.

Because if it didn't, then at some point Q it would run out of gas. Q wouldn't be a gas station, otherwise our car would refuel; so there's some point Q' in between Q and the next gas station from Q. Then driving a car from P to Q' results in a net loss of gas. Then when car 1 drove around the track, it should have had less gas at Q' than it had at P. (That's not 100% obvious in the case where car 1 drove past point Q' before it drove past point P, but it follows from the fact that car 1 had the same amount of gas when it finished as when it started.) Contradiction.

Fuck yeah, I'm a badass.

Re: Hiring the Smartest People in the World

#16

People tend to hire, not so much the best people they can find, but the people who are most like themselves. And if you hire people like yourself, and your job ad says "We hire the smartest people," then you must be the smartest people! I've found it to be a huge negative signal. These sorts of interviews seem to mostly be about developers patting themselves on the back about how they stumped the applicants in interv…

Team fit is important. However definitely want smarter people around us. That is why they are selected otherwise we would do the job ourselves.

Re: Hiring the Smartest People in the World

#17

People tend to hire, not so much the best people they can find, but the people who are most like themselves. And if you hire people like yourself, and your job ad says "We hire the smartest people," then you must be the smartest people! I've found it to be a huge negative signal. These sorts of interviews seem to mostly be about developers patting themselves on the back about how they stumped the applicants in interv…

Team fit is important. However definitely want smarter people around us. That is why they are selected otherwise we would do the job ourselves.

    otherwise we would do the job ourselves
Only if you have infinite time at hand.

Re: Hiring the Smartest People in the World

#19
post #15

Solution to problem 1: summing the numbers and then subtracting the sum from 1 + 2 + 3 + ... + n gives the deleted number x. Solution to problem 2: let x be the deleted number and let y be the duplicated number. Summing the numbers and subtracting the sum from 1 + 2 + 3 + ... + n gives x - y. Xor-ing the numbers and xor-ing the result with (1 xor 2 xor 3 xor ... xor n) gives x xor y. Now x xor y (expressed as a binar…

For question 3, it clearly states two things:

"the total amount of gas available at the stations and in the car is exactly enough for the car to drive around the road once"

and

"the car completes a full circle without running out of gas"

Given the first condition, in your solution, at the exact moment the car completes the drive around the track, it runs out of gas. Therefore, it is impossible to complete it without running out of gas.

Re: Hiring the Smartest People in the World

#20
post #11

A quick Google will find you the answer to the first question. The second just requires an additional equation, where people are suggesting powers in finite groups. This seems rather complex. Can we not reach the same constraints by only summing the even numbers, for instance?

1°: s is the sum of the numbers in the array, x = n (n+1)/2-s 2°: s sum, p product, solve the linear system {n (n+1)/2-x+y=s; n! y = p x}

The second solution works in linear time only if one assumes that multiplication is a constant time operation. But is it really? If you look at how a processor does multiplication it becomes clear it is a O(log n) operation where n is one of the numbers being multiplied. Thus, the second solution is probably a O(nlogn) solution.
Post reply on HN