Panda Guru LogoPanda
Guru

SDE II Swiggy Onsite

Round 1

Questions: Given linked list head pointer. Length of the LinkedList is unknown.
Given two integers N and M.
Print ((N/M)(length of LinkedList))th node data without calculating length of LinkedList. (only in single traversal of linked list).
NOTE: (N <= M) and (length of LinkedList is divisible by M) so, ( (N/M)
(Length of LinkedList)) is always an integer number.
EXAMPLE:
N=3, M=4
LinkedList is: 1->2->3->4->5->6->7->8->9->10->11->12
((3/4)*12) = 9th node data
Output is : 9
LinkedList: 6->8->9->14->67->5->7->56->56
N=2, M=3
(2/3)*9 = 6th node data
Answer = 5

Follow-up Question

I was unable to solve kindly help me leetcode community.

Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.