Shubham Vora has Published 836 Articles

Count of K length substrings containing exactly X vowels

Shubham Vora

Shubham Vora

Updated on 17-Aug-2023 17:44:40

295 Views

In this problem, we need to find a total number of substrings of length K containing exactly K vowels. We will see two different approaches to solving the problem. We can use a naïve approach that checks the number of vowels in each substring of length K. Also, we can ... Read More

Check if substring S1 appear after any occurrence of substring S2 in given sentence

Shubham Vora

Shubham Vora

Updated on 17-Aug-2023 17:42:43

455 Views

In this problem, we need th check whether the substring S1 appears after any occurrence of the substring S2 in the given string S. We can compare the starting index of S1 and S2 in the string S to solve the problem. Problem statement – We have given three substrings ... Read More

Check if any permutation of a given string is lexicographically larger than the other given string

Shubham Vora

Shubham Vora

Updated on 17-Aug-2023 17:39:46

228 Views

We have given two strings and need to check whether the given string's permutations exist such that one permutation can have a larger character than another permutation at the ith index. We can solve the problem by sorting the string and comparing each character of the string one by one. ... Read More

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

Shubham Vora

Shubham Vora

Updated on 17-Aug-2023 17:37:18

184 Views

In this problem, we need to find the maximum length of the sub sequence with the same left and right rotations. The left rotation means moving all characters of the string in the left direction and the first character at the end. The right rotation means moving all string characters ... Read More

Average value of set bit count in given Binary string after performing all possible choices of K operations

Shubham Vora

Shubham Vora

Updated on 17-Aug-2023 17:34:43

166 Views

In this problem, we need to find the average value of the count of set bits after performing K operations of all choices on the given string. There can be a brute force approach to solve the problem, but we will use the probability principles to overcome the time ... Read More

Count of K length substring containing at most X distinct vowels

Shubham Vora

Shubham Vora

Updated on 17-Aug-2023 17:31:46

276 Views

In this problem, we need to find the total number of sub strings of length K containing at most X distinct vowels. We can solve the problem in two different ways. The first way is to get all sub strings and count distinct vowels in each sub string of length ... Read More

Convert given Binary String to Another in Minimum Operations by Flipping all Bits Except any 1

Shubham Vora

Shubham Vora

Updated on 14-Aug-2023 13:39:38

804 Views

In this problem, we need to convert one binary string to another binary string by flipping the characters of the string. We can hold any set bit and flip other bits, and we need to count the total operation to achieve another string by doing it. We can solve the ... Read More

Check if the String has a Reversible Equal Substring at the Ends

Shubham Vora

Shubham Vora

Updated on 14-Aug-2023 13:38:08

163 Views

In this problem, we need to find the reversible equal substring of maximum length from the start and end of the string. The problem is very similar to finding the palindromic string. We can start traversing the string and traverse the string until characters from the start and end match. ... Read More

Abbreviate given String by Replacing all Characters with Length Except the First and Last

Shubham Vora

Shubham Vora

Updated on 14-Aug-2023 13:36:13

256 Views

In this problem, we need to transform the string of a length greater than 2 into its abbreviation form. We can use the ‘length’ property of the string to count the total number of middle characters in the string, and we can first and last characters using the respected index ... Read More

Sorting given Character Array using Linked List

Shubham Vora

Shubham Vora

Updated on 14-Aug-2023 13:32:25

363 Views

In this problem, we need to sort the given array of characters using a linked list. We can use bubble sort, selection sort, merger sort, etc. techniques to sort the array. Here, we will convert the array into the linked list first and then use the selection sort and bubble ... Read More

Advertisements