Shubham Vora has Published 962 Articles

Convert characters of string1 to characters present in string2 by incrementing or decrementing lexicographically

Shubham Vora

Shubham Vora

Updated on 24-Aug-2023 16:31:03

52 Views

In this problem, programmers require to make all characters of str1 equal to any character of str2 by performing the increment or decrement operation. Also, we can increment or decrement rotationally. It means ‘z’ + 1 ==‘a’ and ‘a’ – 1 == ‘z’. We can solve the problem by ... Read More

C++ Program to Find Maximum number of 0s placed consecutively at the start and end in any rotation of a Binary String

Shubham Vora

Shubham Vora

Updated on 24-Aug-2023 16:29:34

78 Views

In this problem, we need to find the maximum consecutive zeros at the start and end of string rotation. We can follow two approaches to solve the problem. The first approach is to find all rotations of the given string and count start and end zeros. The second approach is ... Read More

C++ Program for Queries for rotation and Kth character of the given string in constant time

Shubham Vora

Shubham Vora

Updated on 24-Aug-2023 16:22:24

64 Views

In this problem, we need to perform the given queries on the string. We can solve the problem by making the rotations of the string differently and accessing the required characters using their index. Problem statement – We have given string str of length N and array ‘que’ of size ... Read More

Check whether a Sentence is Tautogram or Not

Shubham Vora

Shubham Vora

Updated on 24-Aug-2023 16:19:24

49 Views

In this problem, we need to check whether the given sentence is tautogramic. We can say any sentence is tautogramic if all words have the same starting character. We will learn two approaches to solving the problem. The logic to solve the problem is to check all words' first characters. ... Read More

Program to construct a DFA to check if a given integer is unsigned or not

Shubham Vora

Shubham Vora

Updated on 18-Aug-2023 18:13:39

150 Views

In this problem, we need to check whether the given number is an unsigned integer using the DFA. We need to construct the DFA using the 2D array to solve the problem. Problem statement – We have given string str of length N. By constructing the DFA, we need ... Read More

Python Program to check if two sentences can be made the same by rearranging the words

Shubham Vora

Shubham Vora

Updated on 18-Aug-2023 18:11:12

106 Views

In this problem, we need to check whether we can make two strings equal by rearranging the words of the string. We will learn three different approaches to solving the problem. In the first approach, we will use a dictionary. In the second approach, we will use the sort() method, ... Read More

Sort an array of strings by replacements with their GCD with elements from another array

Shubham Vora

Shubham Vora

Updated on 18-Aug-2023 17:39:34

52 Views

In this problem, we have given two arrays of strings. We need to replace array1’s values to sort array1. To replace the values of array1, we can take the GCD of the current string of array1 with any string of array2. The GCD of the string is very similar to ... Read More

Modify characters of a string by adding integer values of same-indexed characters from another given string

Shubham Vora

Shubham Vora

Updated on 18-Aug-2023 17:38:30

104 Views

In this problem, we need to modify the given string by adding the value of the digit from the num string to the ASCII value of str’s character. To solve the problem, we can convert the digit character to the actual digit and add it to the ASCII value ... Read More

Modify array by removing characters from their Hexadecimal representations which are present in a given string

Shubham Vora

Shubham Vora

Updated on 18-Aug-2023 15:15:38

47 Views

We have given an array of positive integers and need to modify each element of the array by removing the characters given the ‘hex’ string from the hexadecimal representation of the current element. To solve the problem, we can convert the current number to a hexadecimal number. After that, we ... Read More

Modify a Binary String by flipping characters such that any pair of indices consisting of 1s are neither co-prime nor divisible by each other

Shubham Vora

Shubham Vora

Updated on 18-Aug-2023 15:14:22

90 Views

In this problem, we have given a binary string of length 4*N, and we need to flip zeros of the binary string so that any pair of indices containing ‘1’ should not be co-prime or divisible by each other. Here, we can solve the problem by observation. The string contains ... Read More

Advertisements