Shubham Vora has Published 957 Articles

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

205 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

309 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

Python3 Program for Minimum Rotations Required to get the Same String

Shubham Vora

Shubham Vora

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

137 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

153 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

126 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

193 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

262 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

304 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

703 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

364 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

Advertisements