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.
When the slow node has traveled n steps, fast has traveled (say) kn steps.
- ibimd July 21, 2016If they meet after w steps of the slow node (or kw steps of fast pointer then -
w%p=(kn-n+kw)%p (-n in second expression since we are reducing distance traveled by fast outside the loop)
This means that both side of expression leave same reminder on dividing by p which can be written as
w - lp = (k-1)n + kw - mp (for some l & p)
w(1-k)=(k-1)n+(l-m)p
w=cp-n (c=1-m/1-k)
answer is w%p which is -n%p or (p-n)%p