Shubham Vora has Published 962 Articles

Reorder characters of a string to valid English representations of digits

Shubham Vora

Shubham Vora

Updated on 10-Aug-2023 10:39:25

43 Views

In this problem, we need to reorder the characters of a given string to valid English representations of digits. The first approach can be to find all permutations of the string, extract the English words related to numeric digits, and convert them to digits. Another approach that can be used ... Read More

Reduce a string to a valid email address of minimum length by replacing specified substrings

Shubham Vora

Shubham Vora

Updated on 10-Aug-2023 10:36:28

45 Views

In this problem, we have given the email string containing the ‘dot’ and ‘at’ words. We need to replace them with ‘.’ And ‘@’ characters. Note – The valid email address should contain the ‘@’ character only once. It should contain any prefixes before the ‘@’ character and the ... Read More

Number of substrings having an equal number of lowercase and uppercase letters

Shubham Vora

Shubham Vora

Updated on 10-Aug-2023 10:30:04

196 Views

In this problem, we need to count the total number of strings of the given string containing an equal number of lowercase and uppercase characters. The naïve approach to solving the problem is to find all substrings and count the total number of substrings with an equal number of lowercase ... Read More

Modify a string by circularly shifting each character to the right by respective frequencies

Shubham Vora

Shubham Vora

Updated on 10-Aug-2023 10:28:16

71 Views

In this problem, we need to right-shift each character of a given string by its frequency. To solve the problem, we can count the frequency of each character and store it in a data structure like an array or map. After that, we can use the ASCII values of the ... Read More

Minimum subsequences of a string A required to be appended to obtain the string B

Shubham Vora

Shubham Vora

Updated on 10-Aug-2023 10:26:30

130 Views

In this problem, we need to construct the str2 by using the subsequences of the str1. To solve the problem, we can find subsequences of the str1 so that it can cover the substring with a maximum length of str2. Here, we will learn two different approaches to solving the ... Read More

Count permutations possible by replacing ‘?’ characters in a Binary String

Shubham Vora

Shubham Vora

Updated on 10-Aug-2023 10:24:47

82 Views

In this problem, we have given a string containing 0, 1, and ? characters. We need to find permutations of the string by replacing ‘?’ with 0 and 1. The logic to solve the problem is that we can replace every ‘?’ with either 0 or 1. So, by replacing ... Read More

Count new pairs of strings that can be obtained by swapping first characters of pairs of strings from given array

Shubham Vora

Shubham Vora

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

61 Views

In this problem, we need to select the pair of strings and swap their first character. After that, we need to count the total number of new pairs. We can solve the problem by swapping the first character of each pair and checking whether it exists in the array. The ... Read More

Check if the number formed by concatenating all array elements is a Harshad number or not

Shubham Vora

Shubham Vora

Updated on 10-Aug-2023 10:19:29

51 Views

In this problem, we have given the array of integers. We need to combine all elements in a single integer and check if it is a Harshad number. Before we move with the solution, let’s understand Harshad number. All numbers are Harshad numbers which are divisible by the sum of ... Read More

Check if all characters of a string can be made equal by increments or decrements

Shubham Vora

Shubham Vora

Updated on 10-Aug-2023 10:17:50

141 Views

In this problem, we need to check if we can make all characters of strings equal by increment and decrement operations. We can get the weight of each character based on their ASCII values and check whether the total weight can be used to make all characters equal. Problem statement ... Read More

Size of all Connected Non-Empty Cells of a Matrix

Shubham Vora

Shubham Vora

Updated on 02-Aug-2023 15:59:44

73 Views

In this problem, we will find the size of sets of all non−empty connected cells. We will learn two different approaches for finding the size of all non−empty connected cells of a matrix. In the first approach, we will use the breadth−first search algorithm, and in the second approach, we ... Read More

Advertisements