Sunidhi Bansal has Published 1085 Articles

Count of total anagram substrings in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 03-Dec-2020 07:16:14

760 Views

We are given a string str[] as input. The goal is to count the number of anagram substrings present in str[]. Two strings are anagrams of each other if they contain the same number of characters and all characters occur in both. The order of characters can be different.“abc” is ... Read More

Count of suffix increment/decrement operations to construct a given array in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 03-Dec-2020 07:14:43

154 Views

We are given a target array arr[] containing positive integers. The goal is to construct the target array arr[] using an initial array with all 0s. The operations that can be applied on a given empty array with all 0s will suffix increment/decrement operations.If we choose any index say i, ... Read More

Count of words whose i-th letter is either (i-1)-th, i-th, or (i+1)-th letter of given word in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Dec-2020 12:44:19

199 Views

We are given a string str[] as input. The goal is to count the words from str[] that have the same length as str[] and have positions of letters such that ith letter is replaced with letter at position (i1) or (i) or (i+1).For the first letter replacement will be ... Read More

Count pairs with sum as a prime number and less than n in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Dec-2020 12:41:45

372 Views

We are given a positive number n as input. The goal is to find the count of possible pairs (i, j) such that each pair has sum (i+j) which is prime and is less than n. Also i != j and i, j>=1 If n is 4 then only 1 ... Read More

Count permutations that are first decreasing then increasing in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Dec-2020 12:39:34

247 Views

We are a variable num. The goal is to find the count of permutations of numbers between [1, num] in which numbers are first decreasing then increasing. For example if num=3 then numbers are 1, 2, 3. The permutations will be [ 3, 1, 2 ] and [2, 1, 3] ... Read More

Count possible moves in the given direction in a grid in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Dec-2020 12:37:57

275 Views

We are two variables n and m representing a grid of size n x m and initial point x, y to start from.Also given pairs of steps/moves that can be taken to traverse inside the grid as moves ( (1, 1), (2, 2) ) etc. Each pair of moves represents ... Read More

Count pairs of parentheses sequences such that parentheses are balanced in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Dec-2020 12:36:10

898 Views

We are given a string containing the parentheses and the task is to calculate the count of pairs of parentheses sequences that can be formed such that the parentheses are balanced.Parentheses are said to be balanced when there are equal numbers of opening and closing brackets. The parentheses used once ... Read More

Count of operations to make a binary string “ab” free in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Dec-2020 12:34:08

287 Views

We are given a string which can contain “ab” and the task is to calculate the count of operations required to remove or delete “ab” from the string. So, our task is to firstly check whether the string contains “ab” or not if yes then we have to make string ... Read More

Count of sub-arrays whose elements can be re-arranged to form palindromes in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Dec-2020 12:32:54

272 Views

We are given an array of integer elements and the task is to calculate the count of sub-arrays that can be formed from the given array such that its elements can form a valid palindrome. Palindromes are the sequences that are arranged similarly from start and the end.Input − int ... Read More

Count of strings that can be formed from another string using each character at-most once in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Dec-2020 12:29:30

367 Views

We are given two strings i.e. str1 and str2 and the task is to calculate the count of strings that can completely be generated from another string, but we can use one character once for forming the string. Like, we will take two strings str1 and str2 and check for ... Read More

Advertisements