Shubham Vora has Published 793 Articles

Lexicographically Largest String With Sum Of Characters Equal To N

Shubham Vora

Shubham Vora

Updated on 18-Jul-2023 17:10:57

602 Views

Problem Statement We have given a positive integer num. We need to find the lexicographically largest string of lowercase alphabetical characters such that the sum of all characters of the string is equal to num. Here, ‘a’ = 1, ‘b’ = 2, ‘c’ = 3, ‘d’ = 4, …., ‘z’ ... Read More

Distinct Numbers Obtained By Generating All Permutations Of a Binary String

Shubham Vora

Shubham Vora

Updated on 18-Jul-2023 17:09:11

516 Views

Problem Statement We have given binary string str of length N. We need to find all permutations of the string, convert them to the decimal value, and return all unique decimal values. Sample Examples Input str = ‘1’ Output [1] Explanation All permutations of the ‘1’ is only ... Read More

Count Intervals That Intersects With a Given Meeting Time

Shubham Vora

Shubham Vora

Updated on 18-Jul-2023 17:07:14

162 Views

Problem Statement We have given a two-dimensional array containing the pairs of starting and ending times for time intervals in the 12-hour format. Also, we have given string str in the 12-hour time format. We need to find a total number of intervals which included the time represented by str. ... Read More

Check If a String Can Be Made Palindromic By Swapping Pairs Of Characters From Indices Having Unequal Characters In a Binary String

Shubham Vora

Shubham Vora

Updated on 18-Jul-2023 16:17:27

421 Views

Problem Statement We have given string str and a binary string B. The length of both strings is equal to the N. We need to check if we can make string str palindromic by swapping the characters of it multiple times at any pair of indices that contains unequal ... Read More

Create a string of specific length in C++

Shubham Vora

Shubham Vora

Updated on 18-Jul-2023 16:11:27

9K+ Views

In C++, the string is a collection of various alphanumeric and special characters. We can create a string using the ‘string’ data type in C++. Problem Statement We have given a length of the string and one single character, and we require to generate a string of a given ... Read More

Check if uppercase characters in a string are used correctly or not

Shubham Vora

Shubham Vora

Updated on 18-Jul-2023 16:08:57

369 Views

Problem Statement We have given a string ‘str’, containing the alphabetical characters in uppercase or lowercase. We require to check if uppercase characters are used correctly in the string. Followings are the correct way to use uppercase characters in the string. If only the first character is in uppercase, ... Read More

Reverse given Range of String for M queries

Shubham Vora

Shubham Vora

Updated on 17-Jul-2023 16:34:47

377 Views

In this problem, we will perform M reverse queries on the given string according to the array values. The naïve approach to solving the problem is to reverse each string segment according to the given array value. The optimized approach uses the logic that when we reverse the same ... Read More

Parity of Count of Letters whose Position and Frequency have Same Parity

Shubham Vora

Shubham Vora

Updated on 17-Jul-2023 16:32:47

275 Views

In this problem, we will count the number of characters whose frequency and position have the same parity and print the count of the number as odd or even. To solve the problem, we can find the frequency of each character in the string, and count total characters whose freqeuncy ... Read More

Minimize Removal from Front or End to Make the Binary String at Equilibrium

Shubham Vora

Shubham Vora

Updated on 17-Jul-2023 16:26:57

182 Views

In this problem, we will print the minimum number of characters that we need to remove from the start and end to make the count of ‘1’ and ‘0’ the same in the given string. If we find the largest substring with an equal number of ‘1’ and ‘0’, ... Read More

Minimize Max Frequency Difference of 0 & 1 by Dividing Binary String into K Disjoint Subsequence

Shubham Vora

Shubham Vora

Updated on 17-Jul-2023 16:25:19

169 Views

In this problem, we will divide the given binary string into the K subsequences such that we can minimize the maximum absolute difference of count of ‘1’ and ‘0’ in the given string. The logic to solve the problem is to create a maximum pair of 0 and 1 in ... Read More

Advertisements