Shubham Vora has Published 962 Articles

Maximum number of Strings with Common Prefix of length K

Shubham Vora

Shubham Vora

Updated on 31-Aug-2023 18:22:33

78 Views

In this problem, we need to count the maximum string having common prefix of length K. We can take prefix of length K from all strings and count maximum number of similar prefix using the map data structure. Also, we can use the Trie data structure to solve the problem. ... Read More

Maximize value of Palindrome by rearranging characters of a Substring

Shubham Vora

Shubham Vora

Updated on 31-Aug-2023 18:18:39

89 Views

In this problem, we need to find the maximum palindromic string by rearranging the characters of any substring of the given string. We will use bitmasking to solve the largest palindromic substring. If any substring has bitmasking 0, it contains all characters even a number of times. So, we ... Read More

How to validate ISIN using Regular Expressions?

Shubham Vora

Shubham Vora

Updated on 31-Aug-2023 10:05:54

327 Views

In this problem, we will use the regular expression to validate the ISIN number in C++. The ISIN stands for the International Securities Identification Number. It is a unique code to identify stocks, financial bonds, etc. The length of the ISIN number can be 12 or 14, which provides international ... Read More

Find the final String by incrementing prefixes of given length

Shubham Vora

Shubham Vora

Updated on 31-Aug-2023 09:20:34

59 Views

In this problem, we need to increase each character of multiple prefixes of size given in the array. The naïve approach to solving the problem is to take each prefix of the size given in the array and increment each character of the prefix by 1. The best approach is ... Read More

Substring with maximum ASCII sum when some ASCII values are redefined

Shubham Vora

Shubham Vora

Updated on 29-Aug-2023 19:18:50

73 Views

In this problem, we will find the substring of the given string whose character's ASCII value's sum is maximum when we redefine the ASCII values. The naïve approach to solve the problem is to find the sum of all substring's character's ASCII value and get the substring having maximum ... Read More

Python Program for Convert characters of a string to opposite case

Shubham Vora

Shubham Vora

Updated on 29-Aug-2023 19:14:16

182 Views

In this problem, we will toggle the case of each string character. The easiest way to toggle the case of each string character is using the swapcase() built-in method. Also, we can use the ASCII values of the characters to swap their case. Python also contains isUpper() and isLower() ... Read More

Minimize Suffix flip to make Binary String non decreasing

Shubham Vora

Shubham Vora

Updated on 29-Aug-2023 19:12:16

64 Views

In this problem, we will count the number of minimum operations required to convert string non-decreasing order by flipping the characters of the binary string. We can flip all characters of the substring starting from the \mathrm{p^{th}} index if the character at the pth index is 0 and not ... Read More

Maximum point to convert string S to T by swapping adjacent characters

Shubham Vora

Shubham Vora

Updated on 29-Aug-2023 19:09:35

47 Views

In this problem, we will find the maximum points while converting the string S to T according to the conditions in the problem statement. We can traverse the string S and make each character of the string S same as string T's character at the same index by ... Read More

Maximum bitwise OR on of any two Substrings of given Binary String

Shubham Vora

Shubham Vora

Updated on 29-Aug-2023 18:52:43

60 Views

In this problem, we need to find the maximum OR value of any two substrings of the given strings. The first approach is to find all substrings of the given binary string, take OR value of each string, and print the maximum OR value. The other approach ... Read More

Count ways to form N Sized Strings with at most two adjacent different pair

Shubham Vora

Shubham Vora

Updated on 29-Aug-2023 18:38:56

78 Views

In this problem, we will count the number of binary strings of size N, containing at most 2 adjacent distinct pair of characters. It means the string should contain, at most, 2 '01' 0r '10' pairs. The first approach is that generate all binary strings, and if any binary string ... Read More

Previous 1 ... 4 5 6 7 8 ... 97 Next
Advertisements