[go: up one dir, main page]

Open In App

Top 75 DSA Questions

Last Updated : 10 Oct, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

In this post, we present a list of the top 75 data structures and algorithms (DSA) coding questions to help you prepare for a thorough revision for interviews at leading tech companies like Meta, Google, Amazon, Apple, Microsoft, etc. This list helps you to cover an extensive variety of DSA Coding questions ensuring you don't miss any key concepts that could appear in the interview.

Arrays

  1. Next Permutation
  2. Stock Buy and Sell - Multiple Transactions Allowed
  3. Minimize the Heights
  4. First Missing Positive

String

  1. String to Integer - Your Own atoi()
  2. Anagram Check
  3. First Non-Repeating Character
  4. Min Chars to Add for Palindrome

Sorting

  1. Sort 0s, 1s and 2s
  2. Count Inversions
  3. Insert and Merge Interval
  4. Merge two sorted arrays without extra space
  5. Chocolate Distribution Problem

Searching

  1. Search in Rotated Sorted Array
  2. Peak Element
  3. K-th element of two sorted arrays
  4. Allocate Minimum Pages
  5. Kth Missing Positive Number

Matrix

  1. Spiral Traversal
  2. Search in a sorted matrix
  3. Set Matrix Zeroes

Hashing

  1. Print all pairs with given sum
  2. Longest Subsequence with Adjacent Difference of 0 or 1
  3. Longest Consecutive Sequence
  4. Count Subarrays with given XOR

Two Pointer Technique

  1. Triplet Sum
  2. Longest Substring With Distinct Characters
  3. Trapping Rain Water

Prefix Sum

  1. Longest Subarray with Equal No of 0s and 1s
  2. Product of Array except Self
  3. Find Starting Petrol Pump for Circular Tour

Linked List

  1. Reverse a linked list in groups
  2. Segregate even and odd nodes in a Linked List
  3. Clone a Linked List
  4. Remove Loop in Linked List
  5. LRU Cache

Backtracking

  1. Permutations of a String
  2. N Queens

Tree

  1. Construct Tree from Inorder and Preorder
  2. Boundary Traversal
  3. Count all K Sum Paths in Binary Tree
  4. Fixing Two nodes of BST
  5. LCA in BST
  6. Largest BST in a Tree

Heap

  1. Merge K Sorted Lists
  2. Median of a Stream
  3. Top K Frequent Elements in an Array

Stack

  1. Longest Valid Parentheses
  2. Largest Area in a Histogram
  3. Maximum and Minimum of every window size
  4. Min Stack

Queue and Deque

  1. Sliding Window Maximum
  2. Maximum score with jumps of at most length K

Dynamic Programming

  1. Subset Sum Problem
  2. Longest Increasing Subsequence
  3. Longest Palindromic Subsequence
  4. Count Palindromic Substring
  5. Minimum Jumps to Reach End
  6. Coin Change - Minimum Coins
  7. Stock Buy and Sell - Max K Transactions Allowed
  8. House Robber II
  9. Word Break
  10. Count Possible Decodings of a Digit Sequence

Greedy

  1. Minimum Platforms
  2. Job Sequencing
  3. Maximize Partitions with Unique Characters

Graph

  1. Islands in a Graph
  2. Minimum time to Rot Oranges
  3. Cycle in an Undirected Graph
  4. Cycle in a Directed Graph
  5. Topological Sorting
  6. Minimum Cost to connect all points
  7. City with Fewest Neighbors Within Threshold Distance
  8. Email Account Merging

Trie

  1. Insert and Search in a Trie

Similar Reads

What is DSA | DSA Full Form
What is DSA?DSA(Data Structures and Algorithms) is defined as a combination of two separate yet interrelated topics – Data Structure and Algorithms. DSA is one of the most important skills that every computer science student must have. It is often seen that people with good knowledge of these technologies are better programmers than others and thus
2 min read
Top 100 Data Structure and Algorithms DSA Interview Questions Topic-wise
DSA has been one of the most popular go-to topics for any interview, be it college placements, software developer roles, or any other technical roles for freshers and experienced to land a decent job. If you are among them, you already know that it is not easy to find the best DSA interview questions among the vast pool of available problems. So he
4 min read
Circular Linked List meaning in DSA
A circular linked list is a special type of linked list in which the last node is connected to the first node, creating a continuous loop. In a circular linked list, each node has a reference to the next node in the sequence, just like in a regular linked list, but the last node's reference points back to the first node. Characteristics of Circular
3 min read
Queue meaning in DSA
A Queue is defined as a linear data structure that is open at both ends and the operations are performed in the First In First Out (FIFO) order. Characteristics of Queue:The first item added to the queue is the first one to be processed (or can be firstly deleted/removed), and subsequent items are processed in the order they were added.Enqueue and
3 min read
Subarray meaning in DSA
A subarray is a portion of an array that consists of consecutive elements from the original array. Characteristics of a Subarray:Contiguity: The elements in a subarray are contiguous, meaning they are consecutive and in order in the original array.Length: The length of a subarray can be any positive integer, from 1 to the length of the original arr
2 min read
Disjoint Set meaning and definition in DSA
Disjoint Set is a data structure that keeps track of a set of elements partitioned into a number of disjoint subsets and it is used to efficiently solve problems that involve grouping elements into sets and performing operations on them. Characteristics of the Disjoint Set:It keeps a set partitioned into disjoint subsets.It allows the efficient uni
2 min read
What is Greedy Algorithm in DSA?
A Greedy Algorithm is defined as a problem-solving strategy that makes the locally optimal choice at each step of the algorithm, with the hope that this will lead to a globally optimal solution. In other words, a greedy algorithm always chooses the option that seems the best at the moment, without considering the future consequences or possibilitie
4 min read
Deque meaning in DSA
Deque, which stands for Double Ended Queue, is a special type of queue that allows adding and removing elements from both front and rear ends. Characteristics: of Deque:Dynamic size: The size of a deque can change dynamically during the execution of a program.Linear: Elements in a deque are stored linearly and can be accessed in a sequential manner
2 min read
Balanced Binary Tree definition & meaning in DSA
Balanced binary tree is defined as a binary tree data structure where there is no more than one height difference between the left and right subtrees of any given node. Mathematically Height of left subtree - Height of right subtree ≤1 Properties of Balanced Binary Tree: A balanced binary tree has a height that is logarithmic in the number of nodes
2 min read
Min Heap meaning in DSA
A min heap is a binary tree-based data structure where the value of each node is less than or equal to its child nodes. In other words, the root node is always the minimum element in the heap. Here is an example of the min heap tree: Characteristics of Min Heap :A min heap is a complete binary tree. This property ensures that the tree is balanced a
3 min read
How to Write DSA Articles on GeeksforGeeks?
GeeksforGeeks provides all the coding enthusiasts an opportunity to showcase their programming and Data Structures & Algorithms skills by writing coding or DSA-based articles. However, a lot of individuals (especially college students or beginners) find it difficult to articulate their learnings & skills and contribute at GeeksforGeeks. But
9 min read
Dynamic Programming meaning in DSA
Dynamic Programming is defined as an algorithmic technique that is used to solve problems by breaking them into smaller subproblems and avoiding repeated calculation of overlapping subproblems and using the property that the solution of the problem depends on the optimal solution of the subproblems Properties of Dynamic Programming:Optimal Substruc
2 min read
Doubly Linked List meaning in DSA
A doubly linked list is a special type of linked list in which each node contains a pointer to the previous node as well as the next node in the structure. Characteristics of the Doubly Linked List: The characteristics of a doubly linked list are as follows: Dynamic size: The size of a doubly linked list can change dynamically, meaning that nodes c
3 min read
Backtracking meaning in DSA
Backtracking can be defined as a general algorithmic technique that considers searching every possible combination in order to solve a computational problem. Backtracking simple structure is shown like the following: Properties of Backtracking:Incremental construction: Backtracking builds a solution incrementally by constructing a partial solution
3 min read
Binary Indexed Tree/Fenwick Tree meaning in DSA
Binary Indexed Tree (BIT), also known as Fenwick Tree, is a data structure used for efficiently querying and updating cumulative frequency tables, or prefix sums. A Fenwick Tree is a complete binary tree, where each node represents a range of elements in an array and stores the sum of the elements in that range. Below is a simple structure of a Bin
3 min read
Branch and Bound meaning in DSA
Branch and bound is an algorithmic technique used in computer science to solve optimization problems. Branch and bound is a systematic way of exploring all possible solutions to a problem by dividing the problem space into smaller sub-problems and then applying bounds or constraints to eliminate certain subproblems from consideration. Characteristi
3 min read
Array Definition & Meaning in DSA
An array is a collection of items of same data type stored at contiguous memory locations Types of Arrays:One-dimensional Array: It is the simplest kind of array where all the elements are stored linearly in a single row. Two-dimensional Array: A two-dimensional array is an array with 2 dimensions, i.e., each unique element is accessed using two it
4 min read
Hashing meaning in DSA
Hashing is defined as a data distribution technique that transforms given key into a different value using hash function for faster access to data. Characteristics of Hashing:Hashing maps the data object to exactly one memory bucket.It allows uniform distribution of keys across the memory.Uses different functions to perform hashing such as mid squa
2 min read
Max Heap meaning in DSA
A max heap is a complete binary tree in which every parent node has a value greater than or equal to its children nodes. Properties of a Max Heap :A max heap is a complete binary tree, meaning that all levels of the tree are completely filled, except possibly the last level which is filled from left to right.In a max heap, every parent node has a v
3 min read
What is Sorting in DSA | Sorting meaning
Sorting is defined as the process of arranging a collection of data elements in a specific order, usually in ascending or descending order based on a specific attribute of the data elements. Characteristics of Sorting:Time Complexity: Time complexity, a measure of how long it takes to run an algorithm, is used to categorize sorting algorithms. The
3 min read
Linked List meaning in DSA
A linked list is a linear data structure used for storing a sequence of elements, where each element is stored in a node that contains both the element and a pointer to the next node in the sequence. Types of linked lists: Linked lists can be classified in the following categories Singly Linked List: This type of linked list consists of nodes that
4 min read
Stack Definition & Meaning in DSA
A stack is defined as a linear data structure that is open at one end and the operations follow the Last-In-First-Out (LIFO) order. Characteristics of Stack:The stack follows the LIFO order, which means that the last element added to the stack will be the first element to be removed.A register that points to the top of the stack is known as the sta
2 min read
Unstable Sort meaning in DSA
Unstable sorting algorithm can be defined as sorting algorithm in which the order of objects with the same values in the sorted array are not guaranteed to be the same as in the input array. Properties of Unstable Sorting Algorithm:They do not require the overhead of keeping the order of equal elements, these algorithms are quicker than stable sort
2 min read
Substring meaning in DSA
A substring is defined as a contiguous part of a string, i.e., a string inside another string. Characteristics of Substring: Starting position of a substring is greater than or equal to the starting index of the string and the ending position is less than or equal to the final position.The maximum length of a substring can be at most the same as th
2 min read
Subsequence meaning in DSA
A subsequence is defined as a sequence that can be derived from another string/sequence by deleting some or none of the elements without changing the order of the remaining elements. For example: Let's take "GeeksForGeeks", GeeksF will be a subsequence of "GeeksForGeeks". Properties of Subsequence:A sequence is a subsequence of itself.The empty seq
2 min read
Trie meaning in DSA
Trie data structure is defined as a Tree based data structure that is used for storing some collection of strings and performing efficient search operations on them. The word Trie is derived from reTRIEval, which means finding something or obtaining it. Representation of trie is similar to a tree data structure with a root node connected to its ele
2 min read
What is Tree | Tree Definition & Meaning in DSA
A tree is defined as a hierarchical data structure in which the elements (known as nodes) are linked together via edges such that there is only one path between any two node of the tree. Properties of Trees:Number of edges: An edge can be defined as the connection between two nodes. If a tree has N nodes then it will have (N-1) edges.Depth of a nod
4 min read
Ternary Search Tree meaning & definition in DSA
Ternary Search Tree is defined as a special trie data structure where the child nodes of a standard trie are ordered as a binary search tree where each node can have at most three children and the left, middle and right subtrees of a node contain values that are less than, equal or greater than the node. Characteristics of Ternary Search Tree:TST i
3 min read
Ternary search meaning in DSA
Ternary search is a searching algorithm which is based on divide and conquer principle that works by dividing the search interval into three parts as in binary search the search interval is divided into two parts. Properties of Ternary Search It works only on sorted arrays either ascending or descending. The ternary search algorithm divides the par
2 min read
Generic Tree meaning & definition in DSA
A generic tree (or N-ary Tree) is a type of tree data structure where each node can have at most N number of children where N can be any integer. Characteristics of Generic Tree:Each node can have zero or more child nodes.A node can have N number of children where N can be any integer.Each node has a list of pointers that point to the children.Appl
2 min read
Article Tags :
three90RightbarBannerImg