Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b5d671b

Browse files
author
Amogh Singhal
authored
Update Interview_Questions.md
1 parent 09eb1d9 commit b5d671b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

‎Interview_Questions.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
## 1. How to find the middle element of a linked list
22
Solution: Start with two pointer `p` and `q`. For every second iteration of `p`, iterate `q`. When `p` reaches the end of the linked list. `q` will be in the middle of the list.
3+
4+
## 2. How to find the loop or cycle in a linked list
5+
Solution: Start with two pointer `p` and `q`. For every second iteration of `p`, iterate `q`. If `p` and `q` are pointing to the same node, there is a loop or cycle present.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /