Algorithm to find the mth element from the end of list

Banashree Patra
@banashree-patra-m0OJwR โ€ข Oct 26, 2024

Given a singly-linked list, devise a time and space efficient algorithm to find the mth
element from the end of the list.
If m = 0, then your algorithm should return the last element of the list. It should also
take care of boundary conditions. Analyze the time complexity of your algorithm.

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform