Sudhir sharma has Published 1149 Articles

Print All Distinct Elements of a given integer array in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 12:22:59

836 Views

In this problem, we are given an array of integer values. Our task is to print all distinct elements of the array. The output should contain only distinct values.Let’s take an example to understand the problemInput: array = {1, 5, 7, 12, 1, 6, 10, 7, 5} Output: 1 5 ... Read More

Print all distinct integers that can be formed by K numbers from a given array of N numbers in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 12:18:14

255 Views

In this problem, we are given an array of N integers and a number K. Our task is to print all distinct numbers that can be created by adding any K elements from the array. While choosing any number can be repeated K times.Let’s take an example to understand the ... Read More

Print all distinct permutations of a given string with duplicates in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 12:15:39

309 Views

In this problem, we are given a string that may contain duplicate characters. Our task is to print all distinct permutations of the strings.Let’s take an example to understand the problem −Input: string = “XYZ” Output: XYZ XZY YXZ YZX ZYX ZXYTo solve this problem, we have to fix one ... Read More

Print all full nodes in a Binary Tree in C++

sudhir sharma

sudhir sharma

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

631 Views

In this problem, we are given a binary tree. Our task is to print all nodes of the tree that are full nodes.The binary tree is a tree in which a node can have a maximum of 2 child nodes. Node or vertex can have no nodes, one child or ... Read More

Print all funny words in a string in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 11:38:09

217 Views

In this problem, we are given a sentence. Our task is to print all strings from the sentence that are funny words.Funny word is a word that follows the condition - The absolute difference between adjacent characters of the string and its reverse string is equal.|string[0] - string[1]| = |revstring[0]-revstring[1]|Let’s ... Read More

Print all Good numbers in given range in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 11:34:48

828 Views

In this problem, we are given three values L, R, and d. Our task is to print all good numbers within the range L to R that do not contain the d as its digit.A good number is a number in which every digit is larger than the sum of ... Read More

Print all increasing sequences of length k from first n natural numbers in C++

sudhir sharma

sudhir sharma

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

566 Views

In this problem, we are given two integers K and n. Our task is to print all increasing sequences of length K using first n natural numbers.The increasing sequence is a sequence of numbers in which the value of the next element is greater than the previous one.Let’s take an ... Read More

Print all integers that are sum of powers of two given numbers in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 11:28:46

222 Views

In this problem, we are given two numbers a and b and an integer bound and we have to print all values less than binding which is the sum of squares of a and b.Bound >= ai + bjLet’s take an example to understand the problem −Input: a=2, b=3, bound=8 ... Read More

Print all interleavings of given two strings in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 11:25:19

485 Views

In this problem, we are given two string str1 and str2 and we have to print all interleaving strings from both the string.Interleaving string created using two given strings such that the order of characters of each string.Let’s take an example to understand the problem −Input: str1 = “XY” str2= ... Read More

Print all internal nodes of a Binary tree in C++

sudhir sharma

sudhir sharma

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

2K+ Views

In this problem, we are given a binary tree and we have to print all internal nodes of the binary tree.The binary tree is a tree in which a node can have a maximum of 2 child nodes. Node or vertex can have no nodes, one child or two child ... Read More

Advertisements