# Category Archives: Pattern Searching

## Construct a string that has exactly K subsequences from given string

Given a string str and an integer K, the task is to find a string S such that it has exactly K subsequences of given… Read More »

## Remove leading zeros from a Number given as a string

Given a numeric string str, the task is to remove all the leading zeros from a given string. If the string containing only zeros, then… Read More »

## Sum of Hamming difference of consecutive numbers from 0 to N | Set 2

Given a number N, the task is to find the sum of Hamming difference of consecutive numbers from 0 to N. Hamming Distance between two… Read More »

## Maximum inversions in a sequence of 1 to N after performing given operations at most K times

Given two integers N and K, the task is to find the maximum number of inversion in a sequence of first N natural numbers after… Read More »

## First number to leave an odd remainder after repetitive division by 2

Given two integers A and B, the task is to print the integer among the two, which will be converted to an odd integer by… Read More »

## Check if it is possible to reach (x, y) from origin in exactly Z steps using only plus movements

Given a point (x, y), the task is to check if it is possible to reach from origin to (x, y) in exactly Z steps.… Read More »

## Number of cycles in a Polygon with lines from Centroid to Vertices

Given a number N which denotes the number of sides of the polygon where the centroid of the polygon is connected with all the vertices,… Read More »

## Find Nth number in a sequence which is not a multiple of a given number

Given four integers A, N, L and R, the task is to find the N th number in a sequence of consecutive integers from L… Read More »

## Sorting boundary elements of a matrix

Given a matrix mat[][] of size M*N, the task is to sort only the border elements of the matrix in the clockwise direction and print… Read More »

## Color a grid such that all same color cells are connected either horizontally or vertically

Given three integers R, C, N, and an array arr[] of size N. The task is to color all cells of a grid of R… Read More »

## Check if a given string is a Reverse Bitonic String or not

Given a string str, the task is to check if that string is a Reverse Bitonic string or not. If the string str is reverse… Read More »

## Check if a number is binary or not in Java

Given a number N, the task is to check first whether the given number is binary or not and its value should be greater than… Read More »

## How to check if string contains only digits in Java

Given a string str, the task is to write a Java program to check whether a string contains only digits or not. If so, then… Read More »

## Check if an URL is valid or not using Regular Expression

Given a URL as a character string str of size N.The task is to check if the given URL is valid or not. Examples :… Read More »

## Check if a string can be split into substrings starting with N followed by N characters

Given a string str, the task is to check if it can be split into substrings such that each substring starts with a numeric value… Read More »