Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Day 06 #188

Merged
merged 10 commits into from
Mar 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Create Middle of LL.c
pradyumna100903 authored Mar 7, 2024
commit 3bd21364562a867c2031b40b6e7986fd617597e2
17 changes: 17 additions & 0 deletions March/C/Middle of Linked List/Middle of LL.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* struct ListNode *next;
* };
*/
struct ListNode* middleNode(struct ListNode* head) {
struct ListNode* slow = head;
struct ListNode* fast = head;

while(fast && fast->next){
slow = slow->next;
fast = fast->next->next;
}
return slow;
}