Shubham Vora has Published 962 Articles

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

Shubham Vora

Shubham Vora

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

89 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

46 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

53 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

Maximum Product of First and Last Character of String after Rotation

Shubham Vora

Shubham Vora

Updated on 17-Jul-2023 16:22:35

43 Views

In this problem, we will find the maximum possible product of the first and last digits of the string by rotating the string multiple times. The naïve approach is that find all rotations of the string, take the product of the first and last character, and choose the maximum product ... Read More

Make Binary Strings Equal by Replacing 2nd Bit Repeatedly

Shubham Vora

Shubham Vora

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

66 Views

In this problem, we need to convert the bin1 string to the bin2 string by replacing the second character of the bin1 string with the minimum or maximum of the first and second characters and removing the first character. As we need to remove the initial character, we need to ... Read More

Longest Substring of given Characters by Replacing at Most K Characters for Q Queries

Shubham Vora

Shubham Vora

Updated on 17-Jul-2023 16:14:29

108 Views

In this problem, we have given M queries, and after performing each query on the given string, we need to print the maximum length of the string having only the ‘ch’ character. We will use the tabulation method of dynamic programming to find the maximum possible length of the substring ... Read More

Longest Subsequence with Same Char as Substrings and Difference of Frequency at Most K

Shubham Vora

Shubham Vora

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

126 Views

In this problem, we will find the maximum length of the subsequence such that it should contain the contiguous characters, and the frequency difference of all characters won’t differ more than K. We need to find all possible subsequences of the given string and check whether it contains every character ... Read More

Generate Binary String with equal number of 01 and 10 Subsequence

Shubham Vora

Shubham Vora

Updated on 17-Jul-2023 16:06:05

217 Views

In this problem, we will find the binary string of the given length having the same number of ‘01’ and ‘10’ subsequences. The naïve approach to solving the problem is to generate all binary strings of the given length and check whether it contains the same number of ‘10’ ... Read More

Find the Longest Common Substring using Binary search and Rolling Hash

Shubham Vora

Shubham Vora

Updated on 17-Jul-2023 16:03:40

191 Views

In this problem, we will find the longest common substring using the binary search and rolling hash algorithm. The binary search is an efficient technique for searching values in the sorted array. Here, we will use it to find the maximum length of the common substring. The rolling ... Read More

Find Characters Which When Increased by K are Present in String

Shubham Vora

Shubham Vora

Updated on 17-Jul-2023 16:01:01

39 Views

In this problem, we will find all unique characters of the string with their first index, which is present in the string, after incrementing all characters of the given string by K. For a problem solution, we can take each unique character of the given string. Next, we can update ... Read More

Advertisements