Skip to content

Files

Latest commit

c8d0509 Β· Feb 27, 2019

History

History
This branch is 9 commits ahead of, 6 commits behind CodeToExpress/dailycodebase:master.

day49

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Feb 26, 2019
Feb 27, 2019
Feb 26, 2019
Feb 27, 2019

README.md

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