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.
I think this is a variant of the knapsack algorithm without repetition. Assume you have an array of doubles that have the ratios, and then you iterate through the array, and for each index you try every possible combination of ratios that can be formed with that index's ratio and all the indices ahead of it in the array. So for each index you iterate from index to end of array and add up weights seen of each current index to list of already seen weights of which you keep track of. If you find something equal to 1 you return true. If you find something greater than 1 you remove from list as that combo can't form anything less than 1. If you find something less than 1 you append to list as it might contribute to 1 with the adding of a weight in the future. So for each index i, you iterate from j=i to 50, and for each j you update the list of weights k which are just the ratios of sugar in the combo already seen. Runtime is still 0(2^n) because you still have to go through all possible combinations of the indices in the cups array.
Here's the code in java. If you see any bugs please comment below.
- Semo February 10, 2014