Shubham Vora has Published 962 Articles

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

124 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

99 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

74 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

75 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

135 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

74 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

76 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

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

73 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

C++ Program to Find the Mth element of the Array after K left rotations

Shubham Vora

Shubham Vora

Updated on 05-Oct-2023 12:58:55

45 Views

In this problem, we need to print the element from the given index after rotating the array for K times. This problem teaches us to find the element from the particular index in the rotational array. At first sight, the solution that comes to mind is that rotate the array ... Read More

Advertisements