Skip to content

Category Archives: Pattern Searching

Given two integers N and M denoting the dimensions of a chessboard, and two integers X and Y denoting the King’s position, i.e. the cell… Read More
Given a 2D array, board[][] of size 9 × 9, which represents a solution to the Sudoku puzzle, the task is to check if the… Read More
Given N rows and M columns of a matrix, the task is to fill the matrix cells using first K integers such that: Each group… Read More
Given a string S of length N consisting of lowercase letters and an integer K, where N % K = 0, the task is to… Read More
Given an array arr[] consisting of N integers, the task is to find the mean of the array formed by the products of unordered pairs… Read More
Given an integer N, split the first N natural numbers into two sets such that the absolute difference between their sum is minimum. The task… Read More
Given a string S of length N containing lowercase alphabets. Two players A and B play a game optimally in turns, starting with player A.… Read More
Given an array arr[] consisting of N integers, the task is to count the total number of pairs of array elements from the given array… Read More
Given a string S of length N consisting of “?” and lowercase letters, the task is to replace “?” with lowercase letters such that no… Read More
Given string str, the task is to rearrange the given string to obtain the longest palindromic substring. Examples: Input: str = “geeksforgeeks”Output: eegksfskgeeorExplanation: eegksfskgee is… Read More
Given an array arr[] consisting of N integers, the task is to find the sum of all the elements of all possible subarrays of odd… Read More
Given an integer N, the task is to generate a matrix of dimensions N x N using positive integers from the range [1, N] such… Read More
Given two integers A, B which are any two terms of an Arithmetic Progression series, and an integer N, the task is to to construct… Read More
Given string str of length N, the task is to check if the given string contains only special characters or not. If the string contains… Read More