Implementing Genric queue data structure in Java

Given the linked list implementation of a generic queue in Java.

Search in a sorted multi-level linked list

Given a multi-level linked list as shown in this post. Write code to search in such a list.

Printed a sorted multi-level linked list

Given a linked list, where each node has a pointer to the head of its child list (in addition to the next pointer). The child […]

Traverse and print a linked list in forward and backward order

Given a linked list, write code to print the list in forward and backward order. Solution: This problem is discussed as an example in this […]

Find numbers with more than k-bits in their binary representations

Given an array of unsigned integers, print all the numbers that have more than k bits set in their binary representation. For example, if k […]

Remove all white spaces from a string

Given a string that may have white spaces, write code to remove all white spaces from than string. For example: Input String: "IT IS HOT […]

Difference between nodes of alternate vertical levels in a tree

The question below is given in the format in which questions are asked on coding interview Platforms like HackerRank, CodeChef, CodeJam, etc. PROBLEM STATEMENT Vertical […]

Rearrange the nodes of a linked list

Given a linked list, rearrange the node of the list as shown below: INPUT LIST: 1 -> 2 -> 3 -> 4 -> 5 -> […]

Merge alternate nodes of the two lists

We have already seen the code to merge two sorted linked list, such that the final list is also sorted. The logic and code can […]

Water overflowing from glass arranged in form of triangle

Glasses are arranged in the form of triangle (on top of each other) as shown below: 1 2 3 4 5 6 7 8 9 […]