Skip to content

Latest commit

 

History

History
10 lines (7 loc) · 428 Bytes

README.md

File metadata and controls

10 lines (7 loc) · 428 Bytes

<< [26] Remove the kth element from a linked list >>

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.

Example:

>>> coding_problem_26(range(10), 3)
[0, 1, 2, 3, 4, 5, 6, 7, 9]