Shubham Vora has Published 957 Articles

Make all Strings palindrome by swapping characters from adjacent Strings

Shubham Vora

Shubham Vora

Updated on 23-Oct-2023 14:54:49

696 Views

In this problem, we will make all strings of the given array palindromic by swapping the characters of the adjacent string. To solve the problem, we will try to make the character the same at p and str_len - p - 1 index in all strings, and it is only ... Read More

Longest Substring of A that can be changed to Substring of B in at most T cost

Shubham Vora

Shubham Vora

Updated on 23-Oct-2023 14:34:21

245 Views

In this problem, we will find the longest substring of A to convert it to a substring of B starting from the same index in less than T cost. We will use the binary search algorithm to find the maximum length of the substring which follows the given condition. ... Read More

Find two unique Palindrome Strings using given String characters

Shubham Vora

Shubham Vora

Updated on 20-Oct-2023 15:00:47

164 Views

In this problem, we will construct two palindromic strings using the given string’s characters. We can use the character’s frequency to solve the problem. We can construct two new palindromic strings only if both characters’ frequencies are even or if any characters have an even frequency and others have an ... Read More

Find Strings formed by replacing prefixes of given String with given characters

Shubham Vora

Shubham Vora

Updated on 20-Oct-2023 14:45:29

164 Views

In this problem, we will form a triangle from the given string. The triangle will contain the rows equal to the string length - 1, and in each row, we replace the starting characters equal to the row number with '.' Character. We can use the loop to form ... Read More

Count ways to select three indices from Binary String with different adjacent digits

Shubham Vora

Shubham Vora

Updated on 16-Oct-2023 17:35:07

240 Views

In this problem, we will find the number of pairs of 3 indices so that any adjacent indices don’t have the same value in the pair. We can get the output by checking each pair of 3 indexes, but it can be more time-consuming. Another approach to solving the problem ... Read More

Count Substrings with even frequency of each character and one exception

Shubham Vora

Shubham Vora

Updated on 16-Oct-2023 17:27:46

299 Views

In this problem, we will count the number of substrings of the given string containing all characters with even frequency or any single character with odd frequency. We will use the bitmasking technique to solve the problem. In bitmasking, each bit of the binary string represents the character. ... Read More

Count even indices of String whose prefix has prime number of distinct Characters

Shubham Vora

Shubham Vora

Updated on 16-Oct-2023 16:57:47

167 Views

In this problem, we will find total invalid characters in the given string. If total distinct characters till the particular even index is prime, we can say the character is invalid. We can use the map data structure to count the total number of distinct characters while traversing the string. ... Read More

Check if String can be divided into two Subsequences so that product of sum is odd

Shubham Vora

Shubham Vora

Updated on 16-Oct-2023 15:25:08

155 Views

In this problem, we will check if it is possible to divide the given numeric string into two disjoint subsequences such that sum(sub1) * sum(sub2) becomes odd. We need to divide the string into two subsequences such that the sum of the digits of both becomes odd to get the ... Read More

How to use Hashmap in TypeScript?

Shubham Vora

Shubham Vora

Updated on 07-Oct-2023 03:14:43

45K+ Views

The Hashmap is the one kind of data structure that stores the key-value pairs of the different data.  Like other programming languages, TypeScript also contains a built-in map data structure. In JavaScript, we can't define the key or value type that needs to be stored in the map. So, we ... Read More

Maximum count of unique index 10 or 01 substrings in given Binary string

Shubham Vora

Shubham Vora

Updated on 05-Oct-2023 13:00:47

200 Views

In this problem, we will count the maximum number of 10 and 01 pairs that can be formed using the given binary string. To solve the problem, we can check the number of 10 and 01 pairs we can form using adjacent characters without sharing any characters in two pairs. ... Read More

Previous 1 ... 3 4 5 6 7 ... 96 Next
Advertisements