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.
Assuming 1023 is not valid and instead the answer is 1234, observe the following.
- aleck.yd.wu September 12, 2014if Input.length() == 0 || Input.length() > 10 then it won't work...
take the first digit of the input, and increment the first digit to get the next digits.
i.e. Input = 2xxx, output = 2345.
It can easily be seen that this is the optimal solution, as every other number starting with 2 smaller than 2345 will have either duplicates, or violate the increasing sequence rule.
This won't work if we need to roll-over. easy way to check for roll-over is if Input.length() > 10 - firstDigit.
if it's rolled over then it's even simpler, just make a 1234... sequence with length = 1 + Input.length()