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.
Let us parse the expression into an array of lexical tokens, tokens[2*N:0] such that:
- tokens[2*i] i=0,N are the number values
- tokens[2*i-1], i=1,N are the operator values
For each pair of indices (i,j), 0 <= i <= j <= N we define:
• Exp(i,j) = the set of all the expressions can be built with the tokens from 2*i to 2*j
• Min(i,j) = the min value of all the expressions in Exp(i,j)
• Max(i,j) = the max value of all the expressions in Exp(i,j)
Max(0,N) is the max value for the entire expression.
We use dynamic programming to compute Min and Max, based on a few recursive equations.
We cache the computed values as two hash tables, hashMin, hashMax.
Complexity: O(N^3).
- ranan.fraer April 03, 2016There are O(N^2) pairs (i.j). For each pair we compute Min(i,j), Max(i,j) at most once, thanks to the caching. Iterating over k from i+1 to j, takes O(N), so the total is O(N^2 * N) = O(N^3)