Shubham Vora has Published 962 Articles

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

Shubham Vora

Shubham Vora

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

61 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

68 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

91 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

Count Substrings with at least one occurrence of first K alphabet

Shubham Vora

Shubham Vora

Updated on 29-Aug-2023 18:07:29

65 Views

In this problem, we need to count substrings containing a minimum 1 occurrence of all K characters. Here, we will use two different approaches to solve the problem. The first approach takes all substrings of the given string, checks whether the substring contains all K characters, and counts such ... Read More

Count of Strings of Array having given prefixes for Q query

Shubham Vora

Shubham Vora

Updated on 29-Aug-2023 17:59:57

159 Views

In this problem, we will count the number of strings containing query string as a prefix for each query string. We can traverse the list of query strings, and for each query, we can find a number of strings containing it as a prefix. Also, we can use ... Read More

Check if string S can be converted to T by incrementing characters

Shubham Vora

Shubham Vora

Updated on 29-Aug-2023 17:56:05

70 Views

In this problem, we will check whether it is possible to convert string S to T by incrementing the characters of S only once according to the given condition. Here, we can increment any characters by 'I' only once. So, If we need to increment any other character by ... Read More

Reconstruct original string from resultant string based on given encoding technique

Shubham Vora

Shubham Vora

Updated on 25-Aug-2023 17:03:39

57 Views

In this problem, we need to construct the original string from the given string. The given string is formed from the original string using the given rules. Here, we can use the given encryption rule and encrypted string to find the decrypted string by applying the encryption rule in reverse ... Read More

Python3 Program for Longest subsequence of a number having same left and right rotation

Shubham Vora

Shubham Vora

Updated on 25-Aug-2023 17:02:30

59 Views

In this problem, we will find the length of the longest subsequence of the given string such that it has the same left and right rotation. We can solve the problem by finding all subsequences of the given string and checking whether particular subsequences have the same left and ... Read More

Minimum Characters to be Replaced in given String to make all Characters Same

Shubham Vora

Shubham Vora

Updated on 25-Aug-2023 17:01:28

175 Views

In this problem, we will find a minimum number of string characters needed to be replaced to make all characters. In the first approach, we will find the minimum count of the replaceable characters by counting the frequency of each character in the given string. In another approach, we will ... Read More

Minimize Partitions in given String to get Another String

Shubham Vora

Shubham Vora

Updated on 25-Aug-2023 16:59:44

67 Views

In this problem, we need to construct one string by slicing the other string. We can use the longest common substring to solve the problem. We can find the longest common substring between both strings, slice str1 into 1 or 2 parts, and remove the substring from str2. Again, we ... Read More

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