# Category Archives: Linked List

## Sort a linked list of 0s, 1s and 2s by changing links

Given a linked list of 0s, 1s and 2s, sort it. Examples: Input : 2->1->2->1->1->2->0->1->0 Output : 0->0->1->1->1->1->2->2->2 Input : 2->1->0 Output : 0->1->2 Recommended:… Read More »

## Merge two sorted lists (in-place)

Given two sorted lists, merge them so as to produce a combined sorted list (without using extra space). Examples: Input : head1: 5->7->9 head2: 4->6->8… Read More »

## Insert node into the middle of the linked list

Given a linked list containing n nodes. The problem is to insert a new node with data x at the middle of the list. If… Read More »

## Construct a linked list from 2D matrix

Given a matrix. Convert it into a linked list matrix such that each node is connected to its next right and down node. Example: Input… Read More »

## Find modular node in a linked list

Given a singly linked list and a number k, find the last node whose n%k == 0, where n is the number of nodes in… Read More »

## Find the fractional (or n/k – th) node in linked list

Given a singly linked list and a number k, write a function to find the (n/k)-th element, where n is the number of elements in… Read More »

## Veritas Interview Experience | Set 2 ( On Campus )

Veritas visited our college for campus hiring. The CTC offered was 9.26 LPA. There were a total of 105 candidates eligible for the recruitment test.… Read More »

## Adobe Interview Experience | Set 48 (On-Campus)

Coding Round: A variation of Knapsack Easy string manipulation problem A brute-force based string matching problem Technical Round 1: Finding the length of a Linked-List… Read More »

## Reverse a Linked List in groups of given size | Set 2

Given a linked list, write a function to reverse every k nodes (where k is an input to the function). Examples: Inputs: 1->2->3->4->5->6->7->8->NULL and k… Read More »

## Count nodes in Circular linked list

Given a circular linked list, count number of nodes in it. For example, the output is 5 for below list. Recommended: Please try your approach… Read More »

## Find length of loop in linked list

Write a function detectAndCountLoop() that checks whether a given Linked List contains loop and if loop is present then returns count of nodes in loop.… Read More »

## Qualcomm Interview Experience | Set 10 (On-Campus)

Qualcomm came for full time and internship (not both together) in our campus. Test consisted of written test followed with two technical and one HR… Read More »

## An interesting method to print reverse of a linked list

We are given a linked list, we need to print the linked list in reverse order. Examples: Input : list : 5-> 15-> 20-> 25… Read More »

## Queue based approach for first non-repeating character in a stream

Given a stream of characters and we have to find first non repeating character each time a character is inserted to the stream. Examples: Input… Read More »

## Squareroot(n)-th node in a Linked List

Given a Linked List, write a function that accepts the head node of the linked list as a parameter and returns the value of node… Read More »