## Find the minimum positive integer such that it is divisible by A and sum of its digits is equal to B

Given two integers A and B, the task is to find the minimum positive integer N such that N is divisible by A and the… Read More »

## Iterative program to find distance of a node from root

Given the root of a binary tree and a key x in it, find the distance of the given key from the root node. Dis­tance… Read More »

## Check if Queue Elements are pairwise consecutive | Set-2

Given a Queue of integers. The task is to check if consecutive elements in the queue are pairwise consecutive. Examples: Input: 1 2 5 6… Read More »

## Create a tree in level order

Given an array of elements, the task is to insert these elements in level order and construct a tree. Input : arr[] = {10, 20,… Read More »

## Sum of cousins of a given node in a Binary Tree

Given a binary tree and data value of a node. The task is to find the sum of cousin nodes of given node. If given… Read More »

## Sudo Placement[1.3] | Final Destination

Given an array of integers and a number K with initial and final values. Your task is to find the minimum number of steps required… Read More »

## Maximum length of rod for Q-th person

Given lengths of n rods in an array a[]. If any person picks any rod, half of the longest rod (or (max + 1) /… Read More »

## Level order traversal in spiral form | Using one stack and one queue

Write a function to print spiral order traversal of a tree. For below tree, function should print 1, 2, 3, 4, 5, 6, 7. You… Read More »

## Sum of nodes at maximum depth of a Binary Tree | Iterative Approach

Given a root node to a tree, find the sum of all the leaf nodes which are at maximum depth from root node. Example: 1… Read More »

## Minimum steps to reach end from start by performing multiplication and mod operations with array elements

Given start, end and an array of N numbers. At each step, start is multiplied with any number in the array and then mod operation… Read More »

## Minimum number of prefix reversals to sort permutation of first N numbers

Given N numbers which have a permutation of first N numbers. In a single operation, any prefix can be reversed. The task is to find… Read More »

## Check if two nodes are cousins in a Binary Tree | Set-2

Given a binary tree and the two nodes say ‘a’ and ‘b’, determine whether two given nodes are cousins of each other or not. Two… Read More »

## Check if two trees are mirror of each other using level order traversal

Given two binary trees, the task is to check whether the two binary trees is a mirror of each other or not. Mirror of a… Read More »

## Find maximum level product in Binary Tree

Given a Binary Tree having positive and negative nodes, the task is to find maximum product level in it. Examples: Input : 4 / \… Read More »

## Interleave the first half of the queue with second half

Given a queue of integers of even length, rearrange the elements by interleaving the first half of the queue with the second half of the… Read More »