is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.
Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.
Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.
here the main difficulty is to perform the division of 64-bit number by 32-bit efficiently.
Having this operation, say div2by1(), which returns quotient and remainder, single-word division can be realized just in a single loop as follows:
to realize div2by1(x, c) we use floating-point arithmetic to avoid division.
In other words, instead of 'x' dividing by 'c' we multiply x by 1/c using floating-point.
Yet, there is one problem here: namely if the divisor 'c' is small while 'x' is large,
'x/c' might not fit in 53-bit mantissa of floating-point number (resulting in truncation of LSB bits). To avoid this, we first shift 'c' to the left to make sure that its 2 most significant bits
are set. This makes the division only slightly more complicated since, then, we neeed to recover the quotient in two steps. The code is below:
in linux compile with: -lgmp -lstdc++ linker flags (gmp library should be installed by default)
- Anonymous December 28, 2011