McAfee Interview Question for Software Engineer / Developers

Comment hidden because of low score. Click to expand.
of 0 vote

Actually all of the shapes are variants of Y.
Y: L1[i] = L2[j], i != length(L1), j != length(L2).
L: L1[length(L1)] = L2[length(L2)].
I: L1[0] = L2[0].

Finding the intersection point in straightforward. You know that the lists have a common suffix of size K. Therefore L1 will have P1 = length(L1) - K elements that don't occur in L2, and L2 will have P2 = length(L2) - K elements that don't occur in L1. Based on whether P1 > P2 or P2 > P1, you have to move a pointer in the longest one so that the sublist generated by this pointer has the same length as the shorter one. Now you can simply move this pointer and the head of the shorter list in sync, until they are equal.

As for breaking them up, you have to duplicate the common element and append to a list of your choice.


- Alex September 08, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
of 0 votes

Use recursive method, pass head of 2 list node, if LIST meet NULL first then make them to point current LIST2 node and do the same if LIST2 meet NULL first.. And while coming back if both the nodes have diff pointer address then the next of current node will the intersection point.

- SIVAC February 15, 2014 | Flag

Add a Comment

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.


is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More


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.

Learn More

Resume Review

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.

Learn More

Mock Interviews

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.

Learn More