Print missing and duplicate numbers in the given sequence of numbers.

Given a range of natural numbers where some numbers are repeated and some are missing in the range. Our aim is to find missing numbers and repeated numbers. Let us discuss the problem with an example. So for the input {2, 3, 3, 5, 5, 8, 2} our output should be as follows. This problemRead More »

Advertisements

Clone given Graph

Given a graph with an adjacency list, we aim to clone the complete graph with edges. Cloning does creates a new memory for similar data. Let us understand this with a three-node example graph. We can solve this problem using either DFS or BFS. Let’s solve this problem using DFS. Our Graph object contains theRead More »