Skip to content

added 2 more problems on linked lists #73

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
36 changes: 36 additions & 0 deletions Hackerrank/MergePointoftwolinkedlists.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <stdio.h>

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;
}
}
}
110 changes: 55 additions & 55 deletions Hackerrank/README.md
Original file line number Diff line number Diff line change
@@ -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)
27 changes: 27 additions & 0 deletions Hackerrank/Reversingadoublylinkedlist.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <stdio.h>

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;
}