Skip to content

Day 26 #61

Closed
Closed

Description

@vaskoz

Good morning! Here's your coding interview problem for today.

This problem was asked by Google.

Given a singly linked list and an integer k, remove the kth last element from the list. k is guaranteed to be smaller than the length of the list.

The list is very long, so making more than one pass is prohibitively expensive.

Do this in constant space and in one pass.

Activity

  1. self-assigned this
    on Sep 16, 2018
  2. vaskoz commented on Sep 16, 2018

    @vaskoz
    OwnerAuthor

    A fairly simple problem, where you need two pointers to iterate over the list. Start the first pointer towards the end of the list, then start the 2nd pointer after the 1st has already progressed k nodes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions