# Category Archives: Pattern Searching

## How to validate SSN (Social Security Number) using Regular Expression

Given a string str, the task is to check whether the given string is valid SSN (Social Security Number) or not by using Regular Expression.… Read More »

## Number of ways to place two queens on a N*N chess-board

Given an integer N denoting a N * N chess-board, the task is to count the number of ways to place two queens on the… Read More »

## Minimize the non-zero elements in the Array by given operation

Given an array arr[] of length N, the task is to minimize the count of the number of non-zero elements by adding the value of… Read More »

## Check whether the string can be printed using same row of qwerty keypad

Given a string S, the task is to check whether the string can be typed using only a single row of the qwerty keyboard. Examples:… Read More »

## Sort the strings based on the numbers of matchsticks required to represent them

Given an array arr[] of N strings, the task is to sort these strings according to the numbers of sticks required to represent them. Examples:… Read More »

## How to validate image file extension using Regular Expression

Given a string str, the task is to check whether the given string is valid image file extension or not by using Regular Expression. The… Read More »

## How to check Aadhar number is valid or not using Regular Expression

Given a string str, the task is to check whether the given string is a valid Aadhar number or not by using Regular Expression. The… Read More »

## Last digit of sum of numbers in the given range in the Fibonacci series

Given two non-negative integers M, N which signifies the range [M, N] where M ≤ N, the task is to find the last digit of… Read More »

## Make sum of all subarrays of length K equal by only inserting elements

Given an array arr[] of length N such that (1 <= arr[i] <= N), the task is to modify the array, by only inserting elements… Read More »

## Find N values of X1, X2, … Xn such that X1 < X2 < … < XN and sin(X1) < sin(X2) < … < sin(XN)

Given a number N, the task is to find the N integer values of Xi such that X1 < X2 < … < XN and… Read More »

## Minimum and Maximum of all subarrays of size K using Map

Given an array arr[] of N integers and an integer K, the task is to find the minimum and maximum of all subarrays of size… Read More »

## Sum of all elements in an array between zeros

Given an array arr[] of N integers, the task is to find the sum of all elements between two zeros in the given array. If… Read More »

## Find the Nth term of the series 2, 15, 41, 80, 132…

Given a number N, the task is to find the Nth term of the series 2, 15, 41, 80, 132…. Examples: Input: N = 2… Read More »

## Subsequence pair from given Array having all unique and all same elements respectively

Given an array arr[] of N integers, the task is to choose the two subsequences of equal lengths such that first subsequence must have all… Read More »

## Total length of string from given Array of strings composed using given characters

Given a list of characters and an array of strings, find the total length of all strings in the array of strings that can be… Read More »