Skip to content

Category Archives: Strings

Given string str that contains only digits, the task is to return an expression by inserting the ‘+’ or ‘*’ operator between every two digits… Read More
Given numeric string S of size N and a positive integer K, the task is to find the minimum number of adjacent swaps required in… Read More
Given a ternary string S of length N containing only ‘0’, ‘1’ and ‘2’ characters and Q queries containing a range of indices [L, R],… Read More
In the programming world, a string is considered a data type, which in general is a sequence of multiple characters that can contain whitespaces, numbers,… Read More
Given two positive integers L and R and a binary string S of size N, the task is to check if the end of the… Read More
Given two numeric strings A and B, the task is to find the product of the two numeric strings efficiently. Example: Input: A = 5678,… Read More
Given a binary string S of size N and an integer K, the task is to find the maximum length of consecutive 1s or 0s… Read More
Given a positive integer N, the task is to generate N random hexadecimal integers. Examples: Input: N = 3Output:F9AD0D9E19B24CD01A5E   Approach: The given problem can… Read More
Given two arrays arr[] and brr[] of the same size containing strings of equal lengths. In one operation any two characters from any string in… Read More
Given a string S of size N, the task is to find the maximum sum of values assigned to all the alphabets of the string… Read More
Given N strings, print the maximum length of the string and the string formed by concatenating any of the N strings, such that every letter… Read More
Given a numeric string S of size N, the task is to find the number formed by adding numbers 1, 2, 3, … up to… Read More
Given string S of size N, the task is to find the single-digit sum by the repetitive sum of digits of the value obtained by… Read More
Given a string of lowercase letters S a character c. The task is to find minimum K such that every substring of length K contains… Read More
Given a string S of N characters, the task is to calculate the total number of non-empty substrings such that at most one character occurs… Read More