Shubham Vora has Published 957 Articles

Minimum increments by 1 or K required to convert a string into another given string

Shubham Vora

Shubham Vora

Updated on 18-Aug-2023 15:10:46

435 Views

We have given two strings and need to convert one string to another by click increments, and we can increment characters by either 1 or k in the single operation. To solve the problem, we need to make all characters of the first string the same as a second ... Read More

Maximize length of subsequence consisting of single distinct character possible by K increments in a string

Shubham Vora

Shubham Vora

Updated on 18-Aug-2023 14:48:31

220 Views

In this problem, we need to find the maximum length of the subsequence containing the single character by increasing the multiple characters by, at most, k times. We can use the sliding window approach to solve the problem. We can find the maximum length of any window to get ... Read More

Lexicographically smallest string of maximum length made up of first K alphabets that does not contain any repeating substring

Shubham Vora

Shubham Vora

Updated on 18-Aug-2023 14:47:40

359 Views

In this problem, we need to generate a lexicographically smallest string using the first K characters of alphabets so that it doesn’t contain any repeated substring. We can generate a string so that all substrings of length 2 are unique. So, if all substrings of length 2 are unique, all ... Read More

Find the last player to be able to remove a string from an array which is not already removed from other arrays

Shubham Vora

Shubham Vora

Updated on 18-Aug-2023 14:46:49

103 Views

In this problem, two players play a game by removing the string from their array, which is not already removed from the opponent's array. We need to decide the winner of the game. We can solve the problem using two different approaches. In the first approach, we can store the ... Read More

Count points which are revisited while following the path specified by a given string

Shubham Vora

Shubham Vora

Updated on 18-Aug-2023 14:43:28

98 Views

In this problem, we have given a string suggesting the moving direction and starting coordinates. We need to find the revisited positions. We can use the set or map data structure to store the previously visited coordinates. We can say that position is revisited if we find any pair in ... Read More

Count occurrences of substring X before every occurrence of substring Y in a given string

Shubham Vora

Shubham Vora

Updated on 18-Aug-2023 14:42:17

241 Views

In this problem, we need to count the total occurrences of the substring X in the str when we find the substring Y in the given string. We can keep counting the occurrences of the substring X, and when we get the substring Y, we can print the count value. ... Read More

class std::string_view in C++17

Shubham Vora

Shubham Vora

Updated on 18-Aug-2023 14:41:14

278 Views

C++ contains many precious features to enhance the performance of the code, and string_view class is one of them. It is introduced to create a lightweight and non-owning reference to a string. In this tutorial, we will discuss the string_view class and explore a few examples using the string_view class ... Read More

Check if it is possible to obtain a Balanced Parenthesis by shifting brackets to either end at most K times

Shubham Vora

Shubham Vora

Updated on 18-Aug-2023 14:37:31

203 Views

In this problem, we need to check whether we can get the valid balanced subsequence of the parenthesis by moving at most K characters of the string at the end. To solve the problem, we can use the stack data structure. The logic to solve the problem is that if ... Read More

Check if 2 * K + 1 non-empty strings exists whose concatenation forms the given string

Shubham Vora

Shubham Vora

Updated on 18-Aug-2023 14:32:51

116 Views

In this problem, we have given a string, and we need to divide the string into k + 1 substrings such that the concatenation of k + 1 substrings with their reverse can give us the original string. Observation can solve the problem. If the string's first and last ... Read More

Find Last Palindrome String in the given Array

Shubham Vora

Shubham Vora

Updated on 17-Aug-2023 19:00:20

176 Views

In this problem, we need to find the last palindrome string in the array. If any string is the same in reading, either we start to read from the start or end, we can say the string is a palindrome. We can compare the starting and ending characters to check ... Read More

Advertisements