All prep collections

Most Asked Coding Problems

High-frequency coding, DSA, OOP, and logic puzzles that keep showing up across software house interviews — ranked by how often companies ask them.

23 Problems
49+ Companies
Most frequently asked
Updated Aug 2026

23 problems

  • 1

    Second largest or third largest element in an array

    ArraysDSAMedium

    Given an unsorted array of numbers, find the second-largest or third-largest value without simply sorting the entire array — usually expected to be solved in a single pass through the array.

    Asked in 16 companies
    BrainX
    Cinnova
    Devsinc
    Educative
    Mezino technology
    +11
  • 2

    Implement a Queue using one or two Stacks

    Stacks & QueuesDSAMedium

    Design a Queue data structure (First-In-First-Out order) using only Stack operations (Last-In-First-Out order) — implement both enqueue (push) and dequeue (pop) operations correctly.

    Asked in 16 companies
    Arrivy
    BinaryBrix
    Devsinc
    Dubizzle
    Educative
    +11
  • 3

    Explain and write sorting algorithms

    SortingDSAMedium

    Explain how common sorting algorithms work (Bubble Sort, Selection Sort, Merge Sort, Quick Sort), along with their time complexities, and sometimes write the actual code for one of them.

    Asked in 15 companies
    7 Vals
    Arbisoft
    Ashlar
    BrainX
    Devsinc
    +10
  • 4

    Check if a string is a palindrome

    StringsDSAEasy

    Given a string, determine whether it reads the same forwards and backwards (e.g. 'racecar' is a palindrome, 'hello' is not).

    Asked in 13 companies
    Arrivy
    CQTechnologies
    Devsinc
    Educative
    Esketchers
    +8
  • 5

    The Diamond Problem

    OOPMedium

    A classic OOP concept: when a class inherits from two classes that both inherit from a common base class, ambiguity arises about which inherited method version to use. Explain the problem and how different languages solve it.

    Asked in 11 companies
    7 Vals
    BrainX
    Devsinc
    Qbatch
    Rolustech
    +6
  • 6

    Detect and remove a loop (cycle) in a linked list

    Linked ListDSAMedium

    Given a linked list, determine whether it contains a cycle (a node's 'next' pointer eventually points back to an earlier node instead of null), then explain or write code to remove that cycle.

    Asked in 10 companies
    Cogent Labs
    Devsinc
    PakWheels
    Pentaloop
    SSI
    +5
  • 7

    Binary Search

    ArraysDSAEasy

    Given a sorted array and a target value, find the index of that value efficiently by repeatedly halving the search range, instead of checking each element one by one.

    Asked in 9 companies
    7 Vals
    Arrivy
    BrainX
    Devsinc
    Educative
    +4
  • 8

    Delete a specific node from a linked list

    Linked ListDSAMedium

    Given a pointer to a node inside a linked list (sometimes without access to the head), remove that node while keeping the rest of the list intact.

    Asked in 9 companies
    7 Vals
    BrainX
    Devsinc
    Educative
    Foomotion
    +4
  • 9

    Check if two strings are anagrams of each other

    StringsDSAEasy

    Given two strings, determine whether one can be rearranged to form the other (e.g. 'listen' and 'silent').

    Asked in 8 companies
    BrainX
    Codefulcrum
    Devsinc
    Educative
    Focusteck
    +3
  • 10

    Two Sum problem

    ArraysDSAMedium

    Given an array of numbers and a target sum, find a pair of numbers that add up to the target — ideally in a single pass through the array.

    Asked in 7 companies
    BrainX
    Careem Codility
    Cogent Labs
    Devsinc
    Educative
    +2
  • 11

    BFS and DFS traversal

    TreesGraphsDSAMedium

    Explain and/or implement Breadth-First Search and Depth-First Search — the two standard ways of visiting all the nodes of a tree or a graph.

    Asked in 8 companies
    Arrivy
    BrainX
    Devsinc
    Educative
    SSI
    +3
  • 12

    Reverse a linked list

    Linked ListDSAEasy

    Given a linked list, reverse the direction of all its pointers so the last node becomes the first node and vice versa.

    Asked in 7 companies
    BrainX
    Cinnova
    Devsinc
    Educative
    Foomotion
    +2
  • 13

    Find the middle node of a linked list

    Linked ListDSAEasy

    Given a linked list, find its middle node — usually in a single pass, using a slow pointer and a fast pointer moving at different speeds.

    Asked in 7 companies
    Arbisoft
    Devsinc
    Foomotion
    i2c
    +3
  • 14

    Find the missing number in an array

    ArraysDSAEasy

    Given an array that should contain all numbers from 1 to N but is missing exactly one, find the missing number.

    Asked in 7 companies
    CQTechnologies
    Qbatch
    Tajir
    +4
  • 15

    The jug/water-measuring puzzle

    PuzzlesMedium

    A classic logic puzzle: given two jugs of different fixed capacities (commonly 3L and 5L, no markings), figure out a pouring sequence to measure an exact amount (commonly 4L).

    Asked in 7 companies
    BrainX
    Devsinc
    Focusteck
    PakWheels
    Tech Clan
    +2
  • 16

    The rope-burning puzzle

    PuzzlesMedium

    A classic logic puzzle: ropes that each take exactly 1 hour to burn completely (can be lit from either end, don't burn uniformly). Use this to measure exactly 45 minutes.

    Asked in 7 companies
    7 Vals
    BrainX
    Devsinc
    PakWheels
    i2c
    +2
  • 17

    The cake-cutting puzzle

    PuzzlesEasy

    A classic logic puzzle: cut a cake into exactly 8 equal pieces using only 3 straight cuts.

    Asked in 6 companies
    BrainX
    Devsinc
    Tbox Solutionz
    Technosoft
    i2c
    +1
  • 18

    Check whether a number is prime

    MathDSAEasy

    Write a function that determines whether a given number is prime (only divisible by 1 and itself).

    Asked in 6 companies
    Educative
    Hazentech
    MergeStack
    Rolustech
    +2
  • 19

    Calculate factorial of a number

    RecursionDSAEasy

    Write a function (often using recursion) that calculates the factorial of a given number.

    Asked in 6 companies
    Arbisoft
    Educative
    Rolustech
    Techloyce
    TechnoCares
    +1
  • 20

    Flatten a nested or jagged array

    ArraysDSAMedium

    Given an array containing other arrays nested at various levels, convert it into a single flat (one-dimensional) array — usually without built-in library functions, often using recursion.

    Asked in 5 companies
    BinaryBrix
    Devsinc
    Educative
    +2
  • 21

    The weighing-balls puzzle

    PuzzlesMedium

    A classic logic puzzle: among identical-looking balls, one is heavier or lighter than the rest — identify the odd ball using a balance scale in the fewest weighings.

    Asked in 4 companies
    BrainX
    Qbatch
    Technosoft
    +1
  • 22

    Fibonacci sequence

    RecursionDSAEasy

    Write a function (often using recursion) that generates or returns the Nth number in the Fibonacci sequence.

    Asked in 3 companies
    BrainX
    Educative
    +1
  • 23

    Rotate or shift an array

    ArraysDSAEasy

    Given an array and a number of positions, shift or rotate the elements of the array by that many positions.

    Asked in 2 companies
    BrainX
    Devsinc