From 1b8c89f033bcb1cdeb4ecf942918361be9b56367 Mon Sep 17 00:00:00 2001 From: chetan639 Date: Sun, 11 Oct 2020 21:33:05 +0530 Subject: [PATCH 1/2] add problems on doubly linked lists --- Hackerrank/MergePointoftwolinkedlists.c | 36 +++++++++++++++++++++++++ Hackerrank/Reversingadoublylinkedlist.c | 27 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 Hackerrank/MergePointoftwolinkedlists.c create mode 100644 Hackerrank/Reversingadoublylinkedlist.c diff --git a/Hackerrank/MergePointoftwolinkedlists.c b/Hackerrank/MergePointoftwolinkedlists.c new file mode 100644 index 0000000..a89edc4 --- /dev/null +++ b/Hackerrank/MergePointoftwolinkedlists.c @@ -0,0 +1,36 @@ +#include + +typedef struct node +{ + int data; + struct node *next; +} SinglyLinkedListNode; + +int findMergeNode(SinglyLinkedListNode *head1, SinglyLinkedListNode *head2) +{ + + SinglyLinkedListNode *temp1 = head1; + SinglyLinkedListNode *temp2 = head2; + + while (temp1 != temp2) + { + + if (temp1 == NULL) + { + temp1 = head2; + } + else + { + temp1 = temp1->next; + } + + if (temp2 == NULL) + { + temp2 = head1; + } + else + { + temp2 = temp2->next; + } + } +} \ No newline at end of file diff --git a/Hackerrank/Reversingadoublylinkedlist.c b/Hackerrank/Reversingadoublylinkedlist.c new file mode 100644 index 0000000..2f025f1 --- /dev/null +++ b/Hackerrank/Reversingadoublylinkedlist.c @@ -0,0 +1,27 @@ +#include + +typedef struct node +{ + int data; + struct node *next; + struct node *prev; + +} DoublyLinkedListNode; + +DoublyLinkedListNode *reverse(DoublyLinkedListNode *head) +{ + + DoublyLinkedListNode *returner = head; + // DoublyLinkedListNode *temp=head; + + while (head != NULL) + { + DoublyLinkedListNode *prev = head->prev; + head->prev = head->next; + head->next = prev; + returner = head; + head = head->prev; + } + + return returner; +} \ No newline at end of file From ae8683846a304824e1a83bbaeef16c2e9b217cdb Mon Sep 17 00:00:00 2001 From: chetan639 Date: Sun, 11 Oct 2020 21:56:04 +0530 Subject: [PATCH 2/2] Add question links to the Read.md file --- Hackerrank/README.md | 110 +++++++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/Hackerrank/README.md b/Hackerrank/README.md index 81b036f..f836e0c 100644 --- a/Hackerrank/README.md +++ b/Hackerrank/README.md @@ -1,57 +1,57 @@ # These Are The Problem of Above Solutions : - - * ## [A Chessboard Game](https://www.hackerrank.com/challenges/a-chessboard-game-1/problem) - * ## [Alternating Characters](https://www.hackerrank.com/challenges/alternating-characters/problem) - * ## [Beautiful Binary String](https://www.hackerrank.com/challenges/beautiful-binary-string/problem) - * ## [Beautiful Triplets](https://www.hackerrank.com/challenges/beautiful-triplets/problem) - * ## [Between Two Sets](https://www.hackerrank.com/challenges/between-two-sets/problem) - * ## [Bigger is Greater](https://www.hackerrank.com/challenges/bigger-is-greater/problem) - * ## [Birthday Cake Candles](https://www.hackerrank.com/challenges/birthday-cake-candles/problem) - * ## [Breaking the Records](https://www.hackerrank.com/challenges/breaking-best-and-worst-records/problem) - * ## [Caesar Cipher](https://www.hackerrank.com/challenges/caesar-cipher-1/problem) - * ## [Cavity Map](https://www.hackerrank.com/challenges/cavity-map/problem) - * ## [Circular Array Rotation](https://www.hackerrank.com/challenges/circular-array-rotation/problem) - * ## [Closest Numbers](https://www.hackerrank.com/challenges/closest-numbers/problem) - * ## [Counting Valleys](https://www.hackerrank.com/challenges/counting-valleys/problem) - * ## [Cut the sticks](https://www.hackerrank.com/challenges/cut-the-sticks/problem) - * ## [Designer PDF Viewer](https://www.hackerrank.com/challenges/designer-pdf-viewer/problem) - * ## [Encryption](https://www.hackerrank.com/challenges/encryption/problem) - * ## [Fair Rations](https://www.hackerrank.com/challenges/fair-rations/problem) - * ## [Find the Median](https://www.hackerrank.com/challenges/find-the-median/problem) - * ## [Flipping bits](https://www.hackerrank.com/challenges/flipping-bits/problem) - * ## [Game of Thrones - I](https://www.hackerrank.com/challenges/game-of-thrones/problem) - * ## [Grid Challenge](https://www.hackerrank.com/challenges/grid-challenge/problem) - * ## [Hacker Rank HackerRank in a String](https://prosenc.blogspot.com/2017/04/hacker-rank-hackerrank-in-string.html) - * ## [Halloween Sale](https://www.hackerrank.com/challenges/halloween-sale/problem) - * ## [Happy Ladybugs](https://www.hackerrank.com/challenges/happy-ladybugs/problem) - * ## [Ice Cream Parlor](https://www.hackerrank.com/challenges/icecream-parlor/problem) - * ## [Journey to the Moon](https://www.hackerrank.com/challenges/journey-to-the-moon/problem) - * ## [Jumping on the Clouds](https://www.hackerrank.com/challenges/jumping-on-the-clouds/problem) - * ## [Jumping on the Clouds: Revisited](https://www.hackerrank.com/challenges/jumping-on-the-clouds-revisited/problem) - * ## [Number Line Jumps](https://www.hackerrank.com/challenges/kangaroo/problem) - * ## [Lisa's Workbook](https://www.hackerrank.com/challenges/lisa-workbook/problem) - * ## [Lonely Integer](https://www.hackerrank.com/challenges/lonely-integer/problem) - * ## [The Love-Letter Mystery](https://www.hackerrank.com/challenges/the-love-letter-mystery/problem) - * ## [Luck Balance](https://www.hackerrank.com/challenges/luck-balance/problem) - * ## [Marc's Cakewalk](https://www.hackerrank.com/challenges/marcs-cakewalk/problem) - * ## [Mark and Toys](https://www.hackerrank.com/challenges/mark-and-toys/problem) - * ## [Maximum Perimeter Triangle](https://www.hackerrank.com/challenges/maximum-perimeter-triangle/problem) - * ## [Minimum Distances](https://www.hackerrank.com/challenges/minimum-distances/problem) - * ## [Modified Kaprekar Numbers](https://www.hackerrank.com/challenges/kaprekar-numbers/problem) - * ## [Picking Numbers](https://www.hackerrank.com/challenges/picking-numbers/problem) - * ## [The Power Sum](https://www.hackerrank.com/challenges/the-power-sum/problem) - * ## [Roads and Libraries](https://www.hackerrank.com/challenges/torque-and-development/problem) - * ## [Service Lane](https://www.hackerrank.com/challenges/service-lane/problem) - * ## [Sherlock and the Valid String](https://www.hackerrank.com/challenges/sherlock-and-valid-string/problem) - * ## [Smart Number](https://www.hackerrank.com/challenges/smart-number/problem) - * ## [String Construction](https://www.hackerrank.com/challenges/string-construction/problem) - * ## [Strong Password](https://www.hackerrank.com/challenges/strong-password/problem) - * ## [Super Reduced String](https://www.hackerrank.com/challenges/reduced-string/problem) - * ## [Taum and B'day](https://www.hackerrank.com/challenges/taum-and-bday/problem) - * ## [Time Conversion](https://www.hackerrank.com/challenges/time-conversion/problem) - * ## [Two Strings](https://www.hackerrank.com/challenges/two-strings/problem) - * ## [Weighted Uniform Strings](https://www.hackerrank.com/challenges/weighted-uniform-string/problem) - * ## [Sparse Arrays](https://www.hackerrank.com/challenges/sparse-arrays/problem) - * ## [Deletion of a node from linked list](https://www.hackerrank.com/challenges/delete-a-node-from-a-linked-list/problem) - +- ## [A Chessboard Game](https://www.hackerrank.com/challenges/a-chessboard-game-1/problem) +- ## [Alternating Characters](https://www.hackerrank.com/challenges/alternating-characters/problem) +- ## [Beautiful Binary String](https://www.hackerrank.com/challenges/beautiful-binary-string/problem) +- ## [Beautiful Triplets](https://www.hackerrank.com/challenges/beautiful-triplets/problem) +- ## [Between Two Sets](https://www.hackerrank.com/challenges/between-two-sets/problem) +- ## [Bigger is Greater](https://www.hackerrank.com/challenges/bigger-is-greater/problem) +- ## [Birthday Cake Candles](https://www.hackerrank.com/challenges/birthday-cake-candles/problem) +- ## [Breaking the Records](https://www.hackerrank.com/challenges/breaking-best-and-worst-records/problem) +- ## [Caesar Cipher](https://www.hackerrank.com/challenges/caesar-cipher-1/problem) +- ## [Cavity Map](https://www.hackerrank.com/challenges/cavity-map/problem) +- ## [Circular Array Rotation](https://www.hackerrank.com/challenges/circular-array-rotation/problem) +- ## [Closest Numbers](https://www.hackerrank.com/challenges/closest-numbers/problem) +- ## [Counting Valleys](https://www.hackerrank.com/challenges/counting-valleys/problem) +- ## [Cut the sticks](https://www.hackerrank.com/challenges/cut-the-sticks/problem) +- ## [Designer PDF Viewer](https://www.hackerrank.com/challenges/designer-pdf-viewer/problem) +- ## [Encryption](https://www.hackerrank.com/challenges/encryption/problem) +- ## [Fair Rations](https://www.hackerrank.com/challenges/fair-rations/problem) +- ## [Find the Median](https://www.hackerrank.com/challenges/find-the-median/problem) +- ## [Flipping bits](https://www.hackerrank.com/challenges/flipping-bits/problem) +- ## [Game of Thrones - I](https://www.hackerrank.com/challenges/game-of-thrones/problem) +- ## [Grid Challenge](https://www.hackerrank.com/challenges/grid-challenge/problem) +- ## [Hacker Rank HackerRank in a String](https://prosenc.blogspot.com/2017/04/hacker-rank-hackerrank-in-string.html) +- ## [Halloween Sale](https://www.hackerrank.com/challenges/halloween-sale/problem) +- ## [Happy Ladybugs](https://www.hackerrank.com/challenges/happy-ladybugs/problem) +- ## [Ice Cream Parlor](https://www.hackerrank.com/challenges/icecream-parlor/problem) +- ## [Journey to the Moon](https://www.hackerrank.com/challenges/journey-to-the-moon/problem) +- ## [Jumping on the Clouds](https://www.hackerrank.com/challenges/jumping-on-the-clouds/problem) +- ## [Jumping on the Clouds: Revisited](https://www.hackerrank.com/challenges/jumping-on-the-clouds-revisited/problem) +- ## [Number Line Jumps](https://www.hackerrank.com/challenges/kangaroo/problem) +- ## [Lisa's Workbook](https://www.hackerrank.com/challenges/lisa-workbook/problem) +- ## [Lonely Integer](https://www.hackerrank.com/challenges/lonely-integer/problem) +- ## [The Love-Letter Mystery](https://www.hackerrank.com/challenges/the-love-letter-mystery/problem) +- ## [Luck Balance](https://www.hackerrank.com/challenges/luck-balance/problem) +- ## [Marc's Cakewalk](https://www.hackerrank.com/challenges/marcs-cakewalk/problem) +- ## [Mark and Toys](https://www.hackerrank.com/challenges/mark-and-toys/problem) +- ## [Maximum Perimeter Triangle](https://www.hackerrank.com/challenges/maximum-perimeter-triangle/problem) +- ## [Minimum Distances](https://www.hackerrank.com/challenges/minimum-distances/problem) +- ## [Modified Kaprekar Numbers](https://www.hackerrank.com/challenges/kaprekar-numbers/problem) +- ## [Picking Numbers](https://www.hackerrank.com/challenges/picking-numbers/problem) +- ## [The Power Sum](https://www.hackerrank.com/challenges/the-power-sum/problem) +- ## [Roads and Libraries](https://www.hackerrank.com/challenges/torque-and-development/problem) +- ## [Service Lane](https://www.hackerrank.com/challenges/service-lane/problem) +- ## [Sherlock and the Valid String](https://www.hackerrank.com/challenges/sherlock-and-valid-string/problem) +- ## [Smart Number](https://www.hackerrank.com/challenges/smart-number/problem) +- ## [String Construction](https://www.hackerrank.com/challenges/string-construction/problem) +- ## [Strong Password](https://www.hackerrank.com/challenges/strong-password/problem) +- ## [Super Reduced String](https://www.hackerrank.com/challenges/reduced-string/problem) +- ## [Taum and B'day](https://www.hackerrank.com/challenges/taum-and-bday/problem) +- ## [Time Conversion](https://www.hackerrank.com/challenges/time-conversion/problem) +- ## [Two Strings](https://www.hackerrank.com/challenges/two-strings/problem) +- ## [Weighted Uniform Strings](https://www.hackerrank.com/challenges/weighted-uniform-string/problem) +- ## [Sparse Arrays](https://www.hackerrank.com/challenges/sparse-arrays/problem) +- ## [Deletion of a node from linked list](https://www.hackerrank.com/challenges/delete-a-node-from-a-linked-list/problem) +- ## [Finding merge point of two linked lists](https://www.hackerrank.com/challenges/find-the-merge-point-of-two-joined-linked-lists/problem) +- ## [Reversing a doubly linked list](https://www.hackerrank.com/challenges/reverse-a-doubly-linked-list/problem)