GO
DSA Archives - GeeksforGeeks
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
912+ articles
DSA
30 posts
Recent Articles
Power Using Recursion
Last Updated: 06 October 2026
Given two numbers n and p, calculate n^p using recursion.Examples:Input: n = 9, p = 9Output: 387420489Explanation: 9 raised to the power 9 is 387420489.Input: n = 3, p = 3...
read more
DSA
DSA
Mapped String
Last Updated: 17 September 2026
Given n unique characters that are available in unlimited supply, find the number of possible mapped strings of length n. A mapped string follows these properties:The stri...
read more
DSA
DSA
Check Pairs of Equal Sum
Last Updated: 14 September 2026
Given an array arr[]. Find if there are two pairs (a, b) and (c, d) such that a + b = c + d.Examples:Input: arr[] = [3, 4, 7, 1, 2, 9, 8] Output: trueExplanation: (3, 7) a...
read more
DSA
DSA
Strongly Connected Components
Last Updated: 18 October 2026
Given a directed graph with V vertices labeled from 0 to V - 1, represented by an adjacency list adj, find all strongly connected components (SCCs) in the graph. A strongl...
read more
DSA
DSA
Distribution with i allocated to arr[i]
Last Updated: 05 August 2026
Given an integer array arr[] of n elements, where arr[i] represents the number of goodies currently held by the (i+1)th student. The goodies can be redistributed among the...
read more
DSA
Arrays
C++ Mathematical Programs
DSA
Number Squares
Last Updated: 18 July 2026
Given an array arr[] of n unique numeric strings, all of the same length, find all possible arrangements of these strings that form a number square. Strings from the list ...
read more
DSA
Trie
Algorithms-Backtracking
DSA
Append Suffix
Last Updated: 16 July 2026
Given an array arr[] of strings containing lowercase English letters. For each string, if it has already appeared earlier in the array, append a suffix equal to the number...
read more
DSA
DSA
Visitors Without Pass
Last Updated: 15 July 2026
There are n visitors standing in a queue. Each visitor prefers either pass type 0 or pass type 1. There are n passes placed in a stack, where passes[0] represents the pass...
read more
DSA
DSA
First Greater Element
Last Updated: 15 July 2026
Given an array arr[] of integers, for each element arr[i], find the smallest element arr[j] such that j i and arr[j] arr[i]. If no such element exists, return -1 for tha...
read more
DSA
AVL-Tree
Segment-Tree
set
DSA
Distinct Characters In Sorted Manner
Last Updated: 18 July 2026
Given a string s, return a string containing all distinct characters from s in non-decreasing order, without using any sorting algorithm.Examples:Input: s = "abdbc"Output:...
read more
DSA
strings
set
DSA
Keypad typing
Last Updated: 10 July 2026
Given a string s consisting of lowercase English letters. Each letter corresponds to a number on a standard keypad, as shown in the figure. Replace every character in s wi...
read more
DSA
strings
DSA
Maximize Contest Score
Last Updated: 29 June 2026
Geekland is conducting a programming contest that lasts for n minutes.The contest contains en number of easy problems and hn number of hard problems.Geek will be awarded e...
read more
DSA
loop
Maths
DSA
Wine Buying and Selling
Last Updated: 01 July 2026
Given an integer array arr[] representing houses built along a straight line, each value arr[i] represents a certain number of wine bottles that a wants to buy or sell.If ...
read more
DSA
prefix
two-pointer-algorithm
DSA
Count Subsequence Occurrences with Different Characters
Last Updated: 22 May 2026
Given two strings s and w, find the number of times w appears as a subsequence of string s where every character of string s can be included in forming at most one subsequ...
read more
DSA
DSA
Bitwise OR with Next Element
Last Updated: 07 May 2026
Given an array arr[], modify the array in-place such that each element becomes the bitwise OR of itself and its next element. The last element remains unchanged as it has ...
read more
DSA
1
2