Introduction
Backtracking bug
The peer wrote a Sudoku solve with a back tracking bug. I told the peer that Let me review the code and also help to find the bug.
I gave advice on coding style. Do not use i, j instead of using row and column.
Suggest to calculate the next row/ next column and express the intent to calculate.
Write first line of code in the function to discuss base case.
Remove if/ else and nested if/else, make the code flat, avoid smell of arrow-like code.
Most important is to discuss the backtracking and why it is so important to do it.
I enjoyed the discussion, I did see that people do not do backtracking and code still passes all test cases before. This time the backtracking has to be done, otherwise 5 out 7 test cases failed.
For example, Sudoku first row:
5 3 _ _ 7 _ _ _ _
For example, first _ can be filled with 9 possibility, from '1' to '9', for example, for example, '1' is tried, and then continue to second _ which is row 0 and column 3, '2' is put into trial. If '2' fails, then second _ with index of (0,3) should be backtracked to be filled '.'. We need to go back to the first _ to try next available number.
I showed the peer things to work on. Also I learned from the peer through his experience, he had 8 phone interviews for intern, 2 rounds of phone interview for interview, he definitely almost made it. Apple, Facebook, Uber and Microsoft.
All advice are from the code review on stackexchange.com, the question I posted over one month ago.
Talk of graduate study
1. It is hard to get in the computer science master degree program in Northwestern university. The tuition is expensive compared to Santa Clara university, $18,000/term vs $9,000/term.
2. To get a computer master degree, there are 45 credits in the program, non-thesis program. The tuition is around 45 thousand dollars, each credit costs $1,000 dollars. Private university, same tuition for international or noninternational.
3. Around 100 computer science master degree student, half are Chinese, half are Indian.
4. What is advantage of studying in Sillicon Valley?
5. How many of them get intern at Facebook or Apple? Compare to Waterloo university in Canada undergraduate program?
6. What is policy of work visa in USA? OPT or summer intern, 60 days limitation.
7. What is the like to work full time? Do you experience the tough algorithm similar to Leetcode algorithm?
8. What is difference between students with Leetcode practice and full-time programmers with same practice?
9. Rent fee in California, $800/ month for one room or $1100/month to share 2 bed/ two bath condo.
10. Teaching and learning in the university, what is difference? Santa Clara university vs Northwestern university.
11. What is my motivation to practice mock interview?
No comments:
Post a Comment