Sudhir sharma has Published 1206 Articles

Print all combinations of points that can compose a given number in C++

sudhir sharma

sudhir sharma

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

165 Views

In this problem, we are given the total score n. Print all combinations of basketball points that are 1, 2, and 3 that give a total score of n.Let’s see an example to understand the problem, Input: 4 Output: 1 1 1 1 1 1 2 1 2 1 1 ... Read More

Print all distinct characters of a string in order in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 12:28:43

1K+ Views

In this problem, we are given a string. Our task is to print all distinct characters of the string in the order they appear in the string.Let’s take an example to understand our problem, Input: tutorials Point Output: uralsPnThere are multiple ways to solve this problem but we will discuss ... Read More

Print all distinct circular strings of length M in lexicographical order in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 12:25:30

153 Views

In this problem, we are given a string and an integer M. our task is to print all distinct circular strings of length M in lexicographical order (alphabetical order).Let’s take an example to understand the problem, Input: str= “ssssn” M=3 Output: nss sns ssn sssExplanation − all possible circular strings ... Read More

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

sudhir sharma

sudhir sharma

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

650 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

185 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

216 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 even nodes of Binary Search Tree in C++

sudhir sharma

sudhir sharma

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

271 Views

In this problem, we are given a binary search tree. Our task is to print all even valued nodes of the binary search tree.The binary search tree is a binary tree that follows the following condition −The left sub-tree always contains nodes with smaller values than the parent node.Right, sub-tree ... Read More

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

sudhir sharma

sudhir sharma

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

454 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

146 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

649 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

Advertisements