Shubham Vora has Published 962 Articles

Minimum Number That Can Be Obtained By Applying '+' And '*' Operations On Array Elements

Shubham Vora

Shubham Vora

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

58 Views

Problem Statement We have given an array of length ‘N’ containing some positive integers. Also, we have given the string of length ‘N-1’ containing only ‘*’ and ‘+’ characters, where ‘*’ is a multiplication operator, and ‘+’ is an addition operator. We require to perform the arithmetic operation with array ... Read More

Make a String Non-Palindromic By Inserting a Given Character

Shubham Vora

Shubham Vora

Updated on 18-Jul-2023 17:13:31

75 Views

Problem Statement We have given a string str and character c in the input. We need to insert the given character c in the string at the index so that we can convert the string to non-palindromic. If we can’t convert the string to non-palindrome, print ‘-1’. Sample Examples Input ... Read More

Lexicographically Largest String With Sum Of Characters Equal To N

Shubham Vora

Shubham Vora

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

344 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

253 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

47 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

155 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

4K+ 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

123 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

Sort an Array of Strings in Lexicographical Order

Shubham Vora

Shubham Vora

Updated on 17-Jul-2023 16:36:54

620 Views

In this problem, we will sort the array of strings in the lexicographical order. There are various sorting algorithms to sort the array of strings. In this tutorial, we will use the built−in sort() method to sort the strings. Also, we will use the merge sort algorithm, one of ... Read More

Reverse given Range of String for M queries

Shubham Vora

Shubham Vora

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

200 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

Advertisements