Courses
Tutorials
Interview Prep
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
Similar Topics
Web Technologies
32.1K+ articles
Misc
7.7K+ articles
Mathematical
5.1K+ articles
Arrays
4.2K+ articles
Strings
2.1K+ articles
Greedy
1.4K+ articles
Sorting
1.1K+ articles
Dynamic Programming
1.1K+ articles
Searching
1.0K+ articles
Tree
911+ articles
DSA
/
Algorithms
/
Pattern Searching
Pattern Searching
401+ posts
Recent Articles
Popular Articles
Construct longest Array starting with N and A[i] as multiple of A[i+1]
Last Updated: 23 July 2025
Given an integer N, the task is to construct the longest possible array A[], such that the following conditions hold:A[0] = N.No two adjacent elements should be equal.For ...
read more
Pattern Searching
Mathematical
DSA
Arrays
divisors
Rearrange Array to minimize difference of sum of squares of odd and even index elements
Last Updated: 27 March 2023
Given an array arr[] of size N (multiple of 8) where the values in the array will be in the range [a, (a+8*N) -1] (a can be any positive integer), the task is to rearrange...
read more
C/C++ Puzzles
Greedy
Pattern Searching
Geeks Premier League
Geeks-Premier-League-2022
DSA
Generate permutation of [1, N] having bitwise XOR of adjacent differences as 0
Last Updated: 26 September 2022
Given an integer N, the task is to generate a permutation from 1 to N such that the bitwise XOR of differences between adjacent elements is 0 i.e., | A[1]− A[2] | ^ | A[2]...
read more
Pattern Searching
Mathematical
Geeks Premier League
Geeks-Premier-League-2022
DSA
permutation
Bitwise-XOR
Find Numbers in L to R which is same as sum of digits raised to setbit count
Last Updated: 29 April 2022
Given a range of number [L, R], the task is to find all numbers X in the given range such that X = sum of digits raised to setbit count of X i.e., if there are N setbits i...
read more
Greedy
Pattern Searching
Geeks Premier League
Geeks-Premier-League-2022
DSA
Check if two Circular Linked Lists are identical
Last Updated: 23 July 2025
Given two circular linked lists L1 and L2, the task is to find if the two circular linked lists are identical or not.Note: Head of any linked list points to any node of th...
read more
Linked List
Pattern Searching
Geeks Premier League
Geeks-Premier-League-2022
DSA
circular linked list
Construct Array of given size with elements at even positions divisible by their adjacent left
Last Updated: 23 July 2025
Given an integer N, the task is to construct and print an Array, such that:The size of array is NThe elements in array are in range [1, 2*N]Each element in the array are d...
read more
Greedy
Pattern Searching
Mathematical
DSA
Arrays
Search the pattern in given String
Last Updated: 23 July 2025
Given two strings, text and pattern, of size N and M (N M)respectively, the task is to print all occurrences of pattern in text. Examples:Input: text = "This is a dummy t...
read more
Pattern Searching
Advanced Data Structure
DSA
Find elements in Array whose positions forms Arithmetic Progression
Last Updated: 23 July 2025
Given an array A[] of N integers. Consider an integer num such that num occurs in the array A[] and all the positions of num, sorted in increasing order forms an arithmeti...
read more
Pattern Searching
Mathematical
Geeks Premier League
Geeks-Premier-League-2022
DSA
Arrays
Arithmetic Progressions
Convert string S1 to S2 by moving B to right and A to left without crossover
Last Updated: 23 July 2025
Given strings s1 and s2 consisting of 'A', 'B' and '#', where:'#' represents an empty cell'A' represents robots that can move in the left direction and'B' represents robot...
read more
Strings
Pattern Searching
Geeks Premier League
Geeks-Premier-League-2022
DSA
Create Spiral Matrix from Array
Last Updated: 23 July 2025
Given an arrayarr[]and two valuesn and m, the task is to fill amatrixof sizen*min aspiral (or circular)fashion (clockwise) with given array elements.Examples: Input: n = 4...
read more
Pattern Searching
Matrix
Geeks Premier League
Geeks-Premier-League-2022
DSA
Arrays
spiral
Construct an Array of length N containing exactly K elements divisible by their positions
Last Updated: 23 July 2025
Given two integers N and K, the task is to construct an array of length N containing exactly K elements divisible by their positions.Examples:Input: N = 6, K = 2Output: {5...
read more
Pattern Searching
Mathematical
Geeks Premier League
Geeks-Premier-League-2022
DSA
Arrays
Generate a Sequence by inserting positions into Array based on corresponding String value
Last Updated: 23 July 2025
Given a string S of length N. The string consists only of letters 'F' and 'B'. The task is to generate a sequence performing some operations such that:Consider an integer ...
read more
Pattern Searching
Geeks Premier League
Geeks-Premier-League-2022
DSA
Arrays
deque
Find a subsequence which upon reversing gives the maximum sum subarray
Last Updated: 23 July 2025
Given an array arr of integers of size N, the task is to find a subsequence in which upon reversing the order, the maximum sum subarray can be obtained.Examples:Input: arr...
read more
Pattern Searching
DSA
Generate a Permutation of 1 to N with no adjacent elements difference as 1
Last Updated: 23 July 2025
Given an integer N, the task is to construct a permutation from 1 to N where no adjacent elements have difference as 1. If there is no such permutation, print -1.Permutati...
read more
Misc
Pattern Searching
DSA
permutation
Lexicographically largest string formed by choosing words from given Sentence as per given Pattern
Last Updated: 23 July 2025
Given a sentence S and a string B having distinct characters, find a string by joining the words of S according to given conditions:-Choose a word from S ifIt has at least...
read more
Strings
Pattern Searching
DSA
cpp-map
lexicographic-ordering
1
2
3
4
...
27