Shubham Vora has Published 962 Articles

Find frequency of each digit 0-9 by concatenating ASCII values of given string

Shubham Vora

Shubham Vora

Updated on 24-Aug-2023 17:21:14

82 Views

In this problem, we need to count digits frequencies after merging the ASCII values of all characters. The approach to solving the problem is to create a string containing each character's ASCII values and count the frequency of the digits in the string. Problem statement - We have ... Read More

Find all substrings with even 1s whose reverse is also present in given String

Shubham Vora

Shubham Vora

Updated on 24-Aug-2023 17:19:26

65 Views

In this problem, we need to prepare a set of unique substrings of the given binary string and remove them from the set if it contains an even number of 1s and its reverse also exits in the set. We can solve the problem using two ways. The first ... Read More

Encode Strings in form of “xAyB” where x and y and based on count of digits

Shubham Vora

Shubham Vora

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

40 Views

In this problem, we need to encode the string in xAyB format, where x is the count of digits present in both strings at the same index, and y is the count of digits in both strings at different indices. We can solve the problem by counting the same ... Read More

Encode given string by shifting each character forward with its alphabetical value

Shubham Vora

Shubham Vora

Updated on 24-Aug-2023 17:00:06

143 Views

In this problem, we need to calculate the distance between the character and 'a', and by adding it to the character, we need to shift the character. The solution approach is to find the difference between the ASCII values of both characters, and add it to the current character's ... Read More

Java 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:53:07

50 Views

In this problem, programmers require to execute the queries on the string. Also, need to rotate the string and print the characters of the updated string. The best approach to solve the problem is that keep updating the index value and access string characters when we need to print the ... Read More

Java Program for Check if a string can be formed from another string by at most X circular clockwise shifts

Shubham Vora

Shubham Vora

Updated on 24-Aug-2023 16:45:26

53 Views

In this problem, we need to convert one string to another by performing at most x circular shift operations on each character of the first string. The naïve approach to solving the problem is to rotate each character of the alpha1 string for x times, and we check if it ... Read More

Encode given String by inserting in Matrix column-wise and printing it row-wise

Shubham Vora

Shubham Vora

Updated on 24-Aug-2023 16:42:49

81 Views

In this problem, we will encode the string by inserting it in the matrix in a column-wise manner and printing the string in a row-wise manner. The naïve approach to solve the problem is to create a matrix, fill the matrix top-bottom manner, and print the string row-wise. The second ... Read More

Difference between concatenation of strings using (str += s) and (str = str + s)

Shubham Vora

Shubham Vora

Updated on 24-Aug-2023 16:40:30

77 Views

In this tutorial, we will learn the difference between the concatenation of string using the ‘+=’ or ‘+’ operator. Both operators are used to merge strings, but we learn some differences below with examples. What is Addition Assignment (+=) operator? The addition assignment (+=) operator concatenates the two strings. It ... Read More

Decrypt the encoded string with help of Matrix as per given encryption decryption technique

Shubham Vora

Shubham Vora

Updated on 24-Aug-2023 16:35:44

97 Views

In this problem, we need to decrypt the given ciphertext by traversing the matrix diagonally. We can solve the problem by traversing the matrix diagonally. Also, we require to traverse only the upper part of the matrix diagonally to get the decrypted string. Problem statement – We have given an ... Read More

Count of 3 sized Strings of all same or different characters using total X 0s, Y 1s and Z 2s

Shubham Vora

Shubham Vora

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

43 Views

In this problem, we will count the number of strings we can create using the given frequencies such that the string contains same or different characters. We have four options to create a string of length 3 using the 0, 1, and 2 characters. The first string is 012, 000, ... Read More

Advertisements