Sudhir sharma has Published 1206 Articles

Print all Semi-Prime Numbers less than or equal to N in C++

sudhir sharma

sudhir sharma

Updated on 17-Jan-2020 11:01:15

290 Views

In this problem, we are given an integer N. and we have to print all the semiprime numbers that are less than or equal to N.Before solving this problem, let’s understand what is a semi-prime number.A semi-prime number is a number whose value is the product of two distinct prime ... Read More

Print all subarrays with 0 sum in C++

sudhir sharma

sudhir sharma

Updated on 17-Jan-2020 10:56:14

194 Views

In this problem, we are given an array of integer values and we have to print all those subarrays from this array that have the sum equal to 0.Let’s take an example to understand the topic better, Input: array = [-5, 0, 2, 3, -3, 4, -1] Output: Subarray with ... Read More

Print all subsequences of a string using Iterative Method in C++

sudhir sharma

sudhir sharma

Updated on 17-Jan-2020 10:51:55

296 Views

In this problem, we are given a string and we have to find the substring from the given string. The substring to be found should start with a vowel and end with constant character.A string is an array of characters.The substring that is to be generated in this problem can ... Read More

Print all subsequences of a string using ArrayList in C++

sudhir sharma

sudhir sharma

Updated on 17-Jan-2020 10:50:56

82 Views

In this problem, we are given a string and we have to print all subsequences of the string. The substring is formed by deleting elements. Also, the order of string should not be altered.Let’s take an example to understand the problem better −Input: string = “xyz” Output: x y xy ... Read More

Print all Subsequences of String which Start with Vowel and End with Consonant in C++

sudhir sharma

sudhir sharma

Updated on 17-Jan-2020 10:44:00

415 Views

In this problem, we are given a string and we have to find the substring from the given string. The substring to be found should start with a vowel and end with constant character.A string is an array of characters.The substring that is to be generated in this problem can ... Read More

Print all subsequences of a string in C++

sudhir sharma

sudhir sharma

Updated on 17-Jan-2020 10:41:28

253 Views

In this problem, we are given a string and we have to print all the subsequences of the string. The substring generated is created by deleting the elements of the string but the order remains the same(i.e. Order cannot be changed).Let’s take an example to understand the topic better −Input: ... Read More

Print all subsets of given size of a set in C++

sudhir sharma

sudhir sharma

Updated on 17-Jan-2020 10:37:49

657 Views

In this problem, we are given an array and we have to print all the subset of a given size r that can be formed using the element of the array.Let’s take an example to understand the topic better −Input: array = {3, 5, 6} r = 2 Output: 3 ... Read More

Print all substring of a number without any conversion in C++

sudhir sharma

sudhir sharma

Updated on 17-Jan-2020 10:28:05

137 Views

In this problem, we are given an integer n. And we have to print all substrings of a number that can be formed but converting the string are not allowed i.e. we cannot convert an integer into string or array.Let’s take an example to understand the topic better −Input: number ... Read More

Print all the combinations of a string in lexicographical order in C++

sudhir sharma

sudhir sharma

Updated on 17-Jan-2020 10:15:46

366 Views

In this problem, we are given string str, and we have to print all the combinations of the characters in a lexicographical order.Let’s take an example to understand the problem better −Input: str = ‘XYZ’ Output : X XY XYZ XZ XZY Y YX YXZ YZ YZX Z ZX ZXY ... Read More

Print all the combinations of N elements by changing sign such that their sum is divisible by M in C++

sudhir sharma

sudhir sharma

Updated on 17-Jan-2020 10:14:04

139 Views

In this problem, we are given an array of N elements. And need to return all the sums of the elements are divisible by an integer M.Input : array = {4, 7, 3} ; M = 3 Output : 5+4+3 ; 5+4-3To solve this problem, we need to know the ... Read More

Advertisements