Sudhir sharma has Published 1149 Articles

Print all Jumping Numbers smaller than or equal to a given value in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 11:18:45

875 Views

In this problem, we are given a number n and we have to print all jumping numbers that are smaller than or equal to n.Jumping Numbers are the number whose adjacent digits differ by one only. Some jumping numbers are 4565, 98, 7. All single-digit numbers are considered as jumping ... Read More

Print all k-sum paths in a binary tree in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 11:16:03

531 Views

In this problem, we are given a binary tree and a number K and we have to print all paths in the tree which have the sum of nodes in the path equal k.Here, the path of the tree can start from any node of the tree and end at ... Read More

Print All Leaf Nodes of a Binary Tree from left to right using Iterative Approach in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 11:11:47

365 Views

In this problem, we are given a binary tree and we have to print all leaf nodes of the binary tree from left to right the iterative approach.Let’s take an example to understand the problemInput −Output − 1 4 7To solve this problem using the iterative approach, we will use ... Read More

Print all leaf nodes of a binary tree from right to left in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 11:04:51

636 Views

In this problem, we are given a binary tree and we have to print all leaf nodes of the binary tree from right to left.Let’s take an example to understand the problemInput −Output − 7 4 1To solve this problem, we will have to traverse the binary tree. This traversal ... Read More

Print all leaf nodes of an n-ary tree using DFS in C++

sudhir sharma

sudhir sharma

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

585 Views

In this problem, we are given a 2-D array containing the edge of an n-ary where edge defines the edge of the n-ary tree. We have to print all the leaf nodes of the created a-ary tree.The n-ary tree is a tree with has maximum n children i.e. a node ... Read More

Print all multiplicative primes <= N in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 10:55:19

112 Views

In this problem, we are given an integer n and we have to print all multiplicative primes less than or equal to n.Multiplicative primes are prime numbers that have a product of their digits also prime numbers. Like 2, 3, 5, 7, 13, 17.23 is prime but not a multiplicative ... Read More

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

sudhir sharma

sudhir sharma

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

201 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

473 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

231 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

387 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

Advertisements