Shubham Vora has Published 836 Articles

Python3 Program for Minimum Rotations Required to get the Same String

Shubham Vora

Shubham Vora

Updated on 14-Aug-2023 13:28:47

197 Views

In this problem, we need to find the total number of rotations to get the same string. The naïve approach to solving the problem is that we can keep rotating the string. We can print the total number of required rotations if we find the same string. Also, other approaches ... Read More

Python Program for Generating Lyndon Words of Length n

Shubham Vora

Shubham Vora

Updated on 14-Aug-2023 13:27:24

203 Views

In this problem, we will find all Lyndon words using the array's alphanumeric characters. Before we start, let’s understand the definition of the Lyndon word. All words are Lyndon words which are strictly lexicographically smaller than all of their rotations. Here are examples of Lyndon words. ... Read More

PHP Program for Minimum Rotations Required to get the Same String

Shubham Vora

Shubham Vora

Updated on 14-Aug-2023 13:26:07

151 Views

In this problem, we need to achieve the same string by performing the rotations of the string and need to count rotations. There can be different ways to solve the problem, but here we will learn some best approaches in PHP. The first approach uses the rotational substring, and another ... Read More

Minimize Replacement of Bits to make the Count of 01 Substring Equal to 10 Substring

Shubham Vora

Shubham Vora

Updated on 14-Aug-2023 13:23:50

271 Views

Problem statement − We have given the binary string of length N. We need to find the minimum number of flipping characters required to get the balanced binary string. Flipping characters means converting 0 to 1 and 1 to 0. If any string contains an equal number of ‘01’ and ... Read More

Javascript Program to Check If a String is Substring of Another

Shubham Vora

Shubham Vora

Updated on 14-Aug-2023 13:22:10

308 Views

In this problem, we need to ensure whether the string String2 contains string String1 as a substring. We will first see the naïve approach to solving the problem, finding all substrings of String1’s length in String2 with String1. Furthermore, we will use built−in methods like match(), includes(), and indexOf() methods ... Read More

Generate String after Adding Spaces at Specific Positions in a given String

Shubham Vora

Shubham Vora

Updated on 14-Aug-2023 13:03:58

378 Views

In this problem, we need to add spaces before the given indexes in the string. We can use two different approaches to solve the problem. The first approach moves the characters of the given string to add space at a particular index, and the second approach replaces the characters of ... Read More

Find all Palindrome Strings in given Array of Strings

Shubham Vora

Shubham Vora

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

779 Views

We need to find all palindrome strings from the given array in this problem. The string is a palindrome if we can read it the same from the start and end. We can use two approaches to check whether the string is a palindrome. In the first approach, we reverse ... Read More

Decode a String Recursively Encoded as Count followed by Substring

Shubham Vora

Shubham Vora

Updated on 14-Aug-2023 13:00:40

424 Views

In this problem, we need to decode the given string by repeatedly adding the total count number of times. We can have three different approaches to solving the problem, and we can use two stacks or one stack to solve the problem. Also, we can solve the problem without ... Read More

Count the Number of Vowels and Consonants in a Linked List

Shubham Vora

Shubham Vora

Updated on 14-Aug-2023 12:58:00

329 Views

In this problem, we need to count the total vowels and constants in the given linked list. We can traverse the linked list and check for each character, whether it is a constant or vowel. Problem statement − We have given a linked list containing the lowercase alphabetical characters. We ... Read More

Count of each Lowercase Character after Performing described Operations for each Prefix of Length 1 to N

Shubham Vora

Shubham Vora

Updated on 14-Aug-2023 12:56:32

141 Views

In this problem, we need to perform the given operations with each string prefix. In the end, we need to count the frequency of each character. We can follow the greedy approach to solve the problem. We need to take each prefix of length K and update its characters according ... Read More

Advertisements