Amazon Interview Question: Write a function to delete al... | Glassdoor

Interview Question

Software Development Engineer Intern Interview Seattle, WA

Write a function to delete all nodes from a linked list

  that match an input value. Provide test cases.

Interview Answer

1 Answer


public void deleteNodes(int key) {
    Node node = headNode;
    while( != null) {
        if( == key)
             node =;
    if( == key) {
         headNode =;

codewarrior on Mar 2, 2013

Add Answers or Comments

To comment on this, Sign In or Sign Up.