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.
If we take this example
- Abhi June 30, 2013For example: if input = {4,5,6,8,3,1,4,5,6,3,1}
Result: {4,5,6}
Algorithm
1.Take an master list of all the elements and iterate through the elements in the list
List l=new ArrayList();
add the elements {4,5,6,8,3,1,4,5,6,3,1} to l
l={4,5,6,8,3,1,4,5,6,3,1}
2.iterate through the elements and check if the element in the current iteration exists before the current current in the Master list
-->does 4 exist before position 0 in the list -->No
-->does 5 exist before position 1 in the list -->No
-->does 6 exist before position 2 in the list -->No
-->does 8 exist before position 3 in the list -->No
-->does 3 exist before position 4 in the list -->No
-->does 1 exist before position 5 in the list -->No
-->does 4 exist before position 6 in the list -->Yes
if yes add the element to a new list ,
l1={4}
if the next element also exists in the mater list in after the previous element in the sequence then add this element in the list
does 5 exist before position 7 in the list -->Yes
l1={4,5}
and keep on doing this till we get elements in the sequence existing in the master list .
l1={4,5,6}
when the an element that dosent exist in the master list is encountered , then stop adding the elements to the list
and a new list will be formed for and matches going forward
does 6 exist before position 8 in the list -->Yes
l2={6}
does 3 exist before position 9 in the list -->Yes
l3={3}
does 1 exist before position 10 in the list -->No
in the end see how many unique lists we have
l1={4,5,6}
l2={6}
l3={3}
and output is the longest one
{4,5,6}