These two days rushed to participate in two school recruit interview, there are many very interesting algorithm topics, some even did not find the best answer, more open algorithm design topics. In fact, the interview is not just algorithmic communication, which is interspersed with a variety of non-technical issues, unprepared, do not know how to show their own.
seemingly mathematical reasoning for programming problems:
A box has 100 white balls, 100 black balls, each time from the box does not put back the two ball, if the two balls are obtained is the same color, put a white ball, if the two balls to get a different color, put a black ball? What is the probability of leaving a black ball in the last box?
Expansion: A box with M white ball, n black Ball, according to the above scheme, the last box is the probability of remaining a black ball?
The old bottle was loaded with a new wine question:
The merge sort should be well understood, but after describing the idea, the interviewer might say you're going to implement an iterative version of the merge sort?
There's a water tank in the Leetcode,
Given n non-negative integers representing an elevation map where the width of each bar are 1, compute how much WA ter It is the able to trap after raining.
For example,
Given [0,1,0,2,1,0,1,3,2,1,2,1]
, return 6
.
Time complexity O (n), Three-pass algorithm is more easily thought of, one-pass algorithm?
A few interesting algorithmic topics