Sudhir sharma has Published 1206 Articles

Print all n digit patterns formed by mobile Keypad in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 10:49:06

118 Views

In this problem, we are given a number n and we have to print all N digit patterns formed by pressing the mobile keypad button. While pressing the buttons, we can press only nearby buttons of the current button i.e. only keys left, right, up, down can be pressed.Let’s see ... Read More

Print all n-digit numbers whose sum of digits equals to given sum in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 10:43:04

345 Views

In this problem, we are given two numbers n and sum. We have to print all n digit numbers whose sum is equal to the sum. In this problem, numbers with leading 0’s are not considered.Let’s take an example to understand the problem, Input: n = 2 , sum = ... Read More

Print all n-digit numbers with absolute difference between sum of even and odd digits is 1 in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 10:40:04

167 Views

In this problem, we are given an integer n, and we have to print all n-digit numbers such that the absolute difference between the sum of digit of the number at even and odd places is 1. While creating the numbers leading 0’s are not considered.The absolute difference is the ... Read More

Print all n-digit strictly increasing numbers in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 10:36:09

264 Views

In this problem, we are given a number N and we have to print all n-digit numbers whose digits are strickly increasing from MSB to LSB i.e. the number at LSB (left) should be smaller than the number at right.Let’s take an example to understand the problem −Input − n ... Read More

Print all nodes at distance k from a given node in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 10:32:32

399 Views

In this problem, we are given a binary tree, a target node and an integer K. We have to print all the nodes of the tree that are at a distance K from the target node.Binary Tree is a special tree whose each node has at max two nodes (one/two/none).Let’s ... Read More

Print all nodes between two given levels in Binary Tree in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 10:23:32

142 Views

In this problem, we are given a binary tree and two levels in the tree (upper and lower) and we have to print all nodes between upper and lower levels of the tree.The binary tree is a special tree whose each node has at max two nodes (one/two/none).Let’s take an ... Read More

Print all nodes in a binary tree having K leaves in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 10:17:13

103 Views

In this problem, we are given a binary tree and an integer K and we have to print all nodes of the binary tree that have K leaves in their child subtree.The binary tree is a special tree whose each node has at max two nodes (one/two/none).The leaf node of ... Read More

Print all nodes less than a value x in a Min Heap in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 10:13:49

177 Views

In this problem, we are given a Min Heap and a value x and we have to print all nodes less than x.Min heap is a special type of binary tree in which every node has a value less than the node value of its child node.Let’s take an example ... Read More

Print all nodes that are at distance k from a leaf node in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 10:06:10

144 Views

In this problem, we are given a binary tree and a number K. We have to print all nodes of the tree that are at k distance from the leaf node.Binary Tree is a special tree whose each node has at max two nodes (one/two/none).The leaf node of a binary ... Read More

Print all numbers less than N with at-most 2 unique digits in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 10:00:06

113 Views

In this problem, we are given an integer N and we have printed all the number less than N with at-most 2 unique digits i.e. maximum 2 different digits can be used to create the number.Let’s take an example to understand the problem −Input: N = 17 Output: 1 2 ... Read More

Advertisements