Saturday, December 30, 2006

Constellation Energy Strategist Group on-site interview Questions

标 题: Constellation Energy Strategist Group on-site interview Questions
发信站: BBS 未名空间站 (Sat Dec 30 15:49:26 2006)

I spent a super Friday at Constellation’s headquarter at Baltimore with
their strategist groups people. Each of us (candidates) was put in a small
room and 14 people divided in 7 groups rotated and talked to us each for
like 40 minutes.
Try to answer below questions but there is no guarantee.

Q1
A square with four corners A,B,C,D. Suppose you start from corner A and have
equal chance to go to neighboring corners B and D; After reaching new
corner, you again have equal chance to go to its two neighboring corners.
The time consumed to travel on each edge is 1, what is the mean time to come
back to A.
A: Use Binary tree. You will find 50% chance coming back to A at 2n th round
move (thus consume time 2n) from previous round move. So
S=2*(2*1/4+4*1/16+6*1/64+…)=sum(n/2^n) n from 0 to inf.

Q2
Given arbitrary integer, come up with a rule to judge if it is divisible by
9. Prove it.
A: sum up digits of the integer, if sum is more than 10, digits of the sum
again, till you have a single-digit number. If it is 9, then it is divisible
by 9.
Prove: Use induction.
Say you have a number in (100.999) and let it be 100H+10*T+D=99H+9*T+ (H+T+D
), apparently last term (sum of digits) is what we need to prove. It is 3-
digits and true for arbitrary digits.
It is true for 9(n=1, n is number of digits). Then suppose it is true for
arbitrary n, and then prove it is true for n+1.

Q3
What is the properties of p^2-1 where p is prime number larger than 3
A: Divisible by 24. p^2-1=(p+1)(p-1). Consider p-1,p and p+1. They are
consecutive, so one of them is divisible by 3 and it cannot be p. p is odd,
so both p-1 and p+1 are even. Also they are two consecutive even numbers, so
at least one of them is divisible by 4 and the other by 2. Put all together
, the number is divisible is 3*2*4=24

Q4.
There are 100 balls in a bin. Pick one out and number it, then put it back.
Then pick one ball again from bin. If it is numbered already, just put it
back, otherwise number it then put it back. Continue the process till all
balls in the bin are numbered. What is mean numbers of picks needed?
Evaluate the expression numerically.
A: S=100/100+100/99+…..100/1)=100*sum(1/n) n from 1 to 100

Q5.
Evaluate integral of exp(-x^2) from –inf to inf.
A: Expression integrated is similar to Normal distribution PDF, so come out
to be 1 times a factor.

Q6.
There are two targets on a wall. You have n balls. Every time you shoot a
ball on the target, you get $1. Develop a strategy to max your earn.
A: Think of two targets as two circles in a big rectangle (wall). By
symmetry you should center on the line connecting centers of two circles. To
fix a target shooting center, come up with an assumption of the
distribution of landing point of your ball around that center. (ball will
have equal chance to land on circle of certain radius centered around your
target point). Then develop expression of money earned (as function of
distance to center of one target circle), take derivative wrt variable, u
can decide the target point.

Q7.
Given a series X. Find y such that S=sum(abs(xi-y)) is minimized. xi is ith
element of X.
A: S actually is sum of distance of y to all elements of X (1D). So y must
be in (xmin, xmax). And S is constant if X has even number of elements. y
should be median of X if X has odd number of elements.

Q8.
Dice game. One dollar for one point. If you have option to continue to play
second round, what is min points you need to see in order to continue (
expectation of earning with one option). If you have 2nd option to play
third round, what is min point for second round you need to see at 2nd round
((expectation of earning with two options). Program to find mean gain of nth
round game. 一个fair dice掷三次,你有两次机会可以喊停,一旦喊停,色子上给出
几,你就得几块钱。求最佳策略。
A: See “heard on the street”.

Q9.
Roll a penny around another fixed penny in the center with edges in close
contact. After moving half circle around the center penny, you will find the
penny in motion has rotated 360 deg. Why?

Q10.
If a nonhomogenous string can burn and last 30 mins and another string can
last 60 minutes. It is burning at constant rate of materials but not
constant speed since strings are not even along length. How can you time 45
mins.
A: Connect two and burn from both ends.

Q11.
5 Pirates share golden coins problem.

Q12.
A stair of 100 steps. You can either climb either one step or two steps but
no more each time and you can walk up entire stair any way you like with
rule above obeyed. How many possible combinations of ways to finish the walk?
A: Use induction. S(n)=S(n-1)+2*S(n-2). If you finished 99 steps, there is
only one way to finish the last step to finish all 100 steps; If you
finished 98 steps, there are 2 possible ways to finish two remaining steps:
either 1+1 or 2.

Q13.
A very heavy wall moving at 60mph, a ball moving same direction at 120 mph.
What is direction and speed of ball after ball hit wall.
A: Principal of momentum. Ball will move back same speed (as relative speed
before hitting the wall) after hitting relative to wall. Before hitting
relative speed is 60, so after hitting relative speed is -60. Since wall is
moving at 60, so ball will stay still after hitting.

Written questions:
There are 8 questions, 4 for maths and 4 for programming. Need to finish in
1 hour.
Q1. Solve an ODE.
Q2. Given variances and covariance of X and Y. Z=a*X+b*Y. Calc variance of
Z.
Q3. Develop a function to return a list that is inverse order of given
singly linked list.
Q4. Given an array of length m and ask to develop another array containing
average of n consecutive numbers moving rightward in original array with
most efficient algorithm.
A: When calculate moving average of the next n consecutive numbers, you want
to reuse the previous computed moving average. Just multiply that average
by m, minus first number and add a new number, then divide by m again.

No comments: