Computer Science Engineer Interview Questions

478 computer science engineer interview questions shared by candidates

Implement a Linked List class (for ints only) that supports an append function, which simply appends to the end of the list. After that, they asked me to implement an appendAt function that takes two ints as arguments, and appends the second argument to the node containing the first argument in the list. e.g for a list 1 -> 2 -> 3 -> 4 -> 5 , appendAt(3,6) would result in a list: 1 -> 2 -> 3 -> 6 -> 4 -> 5 e.g for a list 1 -> 2 -> 2 -> 3 -> 4 -> 5, appendAt(2,8) would result in: 1 - > 2 -> 8 -> 2 -> 3 -> 4 -> 5 (i.e if the first argument appears more than once in the list, then append the second argument to the first instance of the node containing the first argument) I gave an iterative solution to the problem. The interviewer then asked me to write it recursively. This one is really easy, I faltered on it for some reason.
avatar

Computer Science Intern

Interviewed at Amazon

3.5
Jan 18, 2012

Implement a Linked List class (for ints only) that supports an append function, which simply appends to the end of the list. After that, they asked me to implement an appendAt function that takes two ints as arguments, and appends the second argument to the node containing the first argument in the list. e.g for a list 1 -> 2 -> 3 -> 4 -> 5 , appendAt(3,6) would result in a list: 1 -> 2 -> 3 -> 6 -> 4 -> 5 e.g for a list 1 -> 2 -> 2 -> 3 -> 4 -> 5, appendAt(2,8) would result in: 1 - > 2 -> 8 -> 2 -> 3 -> 4 -> 5 (i.e if the first argument appears more than once in the list, then append the second argument to the first instance of the node containing the first argument) I gave an iterative solution to the problem. The interviewer then asked me to write it recursively. This one is really easy, I faltered on it for some reason.

Viewing 21 - 30 interview questions

See Interview Questions for Similar Jobs

Glassdoor has 478 interview questions and reports from Computer science engineer interviews. Prepare for your interview. Get hired. Love your job.