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.
public static void main(String[] args) {
- huangsiapply December 15, 2015ListNode n1 = new ListNode(3);
ListNode n2 = new ListNode(8);
ListNode n3 = new ListNode(9);
ListNode n4 = new ListNode(7);
ListNode n5 = new ListNode(2);
ListNode n6 = new ListNode(3);
ListNode n7 = new ListNode(4);
ListNode n8 = new ListNode(6);
n1.next = n2;
n2.next = n3;
n3.next = n4;
n4.next = n5;
n5.next = n6;
n6.next = n7;
n7.next = n8;
n8.next = n1;
ListNode head = findPath(n1, 8);
while (head != null) {
System.out.print(head.val + "->");
head = head.next;
}
}
public static ListNode findPath(ListNode head, int target) {
if (head == null)
return head;
while (true) {
if (head.next.val == target)
break;
head = head.next;
}
ListNode p = head.next;
head.next = null;
ListNode res = new ListNode(0);
ListNode nexPossible = p;
int len = 1;
int start = 1;
int max = 0;
while (p.next != null) {
if (p.next.val == target) {
ListNode next = p.next;
p.next = null;
if (len - start + 1 >= max) {
res.next = nexPossible;
max = len - start + 1;
}
nexPossible = next;
p = next;
len++;
start = len;
} else {
p = p.next;
len++;
}
}
if (start == 1)
return null;
if (len - start + 1 >= max) {
res.next = nexPossible;
}
return res.next;
}