Author Archives
Every programmer is an good author!
-
Tower of Hanoi Using Recursion
Tower of Hanoi Using Recursion
The tower of Hanoi is a famous puzzle where we have three rods and N disks. The objective of the puzzle is to move the entire stack to another rod. You are given the number of discs N. Initially, these discs are in the rod 1. You need to print all the steps of discs movement so that all the discs reach the 3rd rod. Also, you need to find the total moves.
Note: The discs are arranged such that the top disc is numbered 1 and the bottom-most disc is numbered N. Also, all the discs have different sizes and a bigger disc cannot be put on the top of a smaller disc. Refer the provided link to get a better clarity about the puzzle. -
Palindrome of String Using Recursion
Palindrome of String Using Recursion
Company tags: Amazon, Cisco, D-E_Shaw, Facebook.. etc.
-
Merge two sorted linked lists Hackerrank Solution.
Merge two sorted linked lists Hackerrank Solution.
-
Insert a node at a specific position in a linked list HackerRank Solution.
Insert a node at a specific position in a linked list HackerRank Solution.
You’re given the pointer to the head node of a linked list, an integer to add to the list and the position at which the integer must be inserted. Create a new node with the given integer, insert this node at the desired position and return the head node. -
Insert a Node at the Tail of a Linked List HackerRank Solution.
Insert a Node at the Tail of a Linked List HackerRank Solution.
You are given the pointer to the head node of a linked list and an integer to add to the list. Create a new node with the given integer. Insert this node at the tail of the linked list and return the head node of the linked list formed after inserting this new node. The given head pointer may be null, meaning that the initial list is empty.
-
Delete duplicate-value nodes from a sorted linked list Java (HackerRank)
Delete duplicate-value nodes from a sorted linked list Java.
You’re given the pointer to the head node of a sorted linked list, where the data in the nodes is in ascending order. Delete as few nodes as possible so that the list does not contain any value more than once. The given head pointer may be null indicating that the list is empty.
-
Print Linked List in Reverse in Java(HackerRank).
Print Linked List in Reverse in Java
-
Insert a node at the head of a linked list in Java HackerRank.
Insert a node at the head of a linked list in Java