Skip to content

Latest commit

 

History

History

day49

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

cover

Day 49 - MiddleMost Node Search

Given a singly linked list, find it's middle-most element, without knowing the size of the linked list or using any counter variable.

Example

given linked list: 1 -> 2 -> 3
output: 2

given linked list: 1 -> 2 -> 3 -> 4
output: 2

HINT

👉 Make 2 pointer variables which would iterate over the Linked List, such that in each iteration, first variable moves 1 step forward, and the second pointer variable moves 2 steps forward.

👉 When the second pointer reaches the end, first pointer would reach to the middlemost element

ques

Solution

JavaScript Implementation

// To Be Added