Problem database last updated: June 20, 2025

SSamsung logo

Samsung Coding Interview Questions

71 problems · 14 Easy, 38 Medium, 19 Hard · Ranked #36 of 458

Difficulty breakdown

14 Easy

20% · avg 23%

38 Medium

54% · avg 59%

19 Hard

27% · avg 18%

Top topics

array
59.2%
dynamic-programming
19.7%
hash-table
19.7%
sorting
18.3%
breadth-first-search
15.5%1.9x
two-pointers
15.5%

Interview profile

Based on 71 reported problems, Samsung interviews are slightly harder than average - 27% Hard vs 18% across all companies. The majority (54%) of questions are Medium difficulty, which is typical for companies that want to see solid fundamentals without excessive trick questions.

Compared to the industry average, Samsung puts unusual emphasis on shortest-path (2.8% of problems, 5.6x the industry average), binary-search-tree (5.6% of problems, 5x the industry average), ordered-set (2.8% of problems, 2.8x the industry average). If you're short on time, these are the categories to double down on.

The most common topics are array (59.2%), dynamic-programming (19.7%), hash-table (19.7%), sorting (18.3%). Problems below are sorted by frequency, the ones at the top are asked most often.

All 71 problems

Burst Balloons

Solve

You are given n balloons, indexed from 0 to n - 1. Each balloon is painted with a number on it represented by an array nums. You are asked to burst all the ball...

HardVery Likely
arraydynamic-programming

Longest Increasing Subsequence

Solve

Given an integer array nums, return the length of the longest strictly increasing subsequence.

MediumVery Likely
arraybinary-searchdynamic-programming

Number of Islands

Solve

Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the number of islands.

MediumVery Likely
arraydepth-first-searchbreadth-first-search

Partition Array Into Two Arrays to Minimize Sum Difference

Solve

You are given an integer array nums of 2 n integers. You need to partition nums into two arrays of length n to minimize the absolute difference of the sums of t...

HardVery Likely
arraytwo-pointersbinary-search

LRU Cache

Solve

Design a data structure that follows the constraints of a Least Recently Used (LRU) cache.

MediumVery Likely
hash-tablelinked-listdesign

Minimum Cost of a Path With Special Roads

Solve

You are given an array start where start = [startX, startY] represents your initial position (startX, startY) in a 2D space. You are also given the array target...

MediumVery Likely
arraygraphheap-priority-queue

Minimize Deviation in Array

Solve

You are given an array nums of n positive integers.

HardVery Likely
arraygreedyheap-priority-queue

Maximum Height by Stacking Cuboids

Solve

Given n cuboids where the dimensions of the ith cuboid is cuboids[i] = [widthi, lengthi, heighti] (0-indexed). Choose a subset of cuboids and place them on each...

HardVery Likely
arraydynamic-programmingsorting

Vertical Order Traversal of a Binary Tree

Solve

Given the root of a binary tree, calculate the vertical order traversal of the binary tree.

HardVery Likely
hash-tabletreedepth-first-search

Trapping Rain Water

Solve

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining.

HardVery Likely
arraytwo-pointersdynamic-programming

Faulty Keyboard

Solve

Your laptop keyboard is faulty, and whenever you type a character 'i' on it, it reverses the string that you have written. Typing other characters works as expe...

EasyVery Likely
stringsimulation

Number of Nodes in the Sub-Tree With the Same Label

Solve

You are given a tree (i.e. a connected, undirected graph that has no cycles) consisting of n nodes numbered from 0 to n - 1 and exactly n - 1 edges. The root of...

MediumVery Likely
hash-tabletreedepth-first-search

Number of Paths with Max Score

Solve

You are given a square board of characters. You can move on the board starting at the bottom right square marked with the character 'S'.

HardVery Likely
arraydynamic-programmingmatrix

Substring with Concatenation of All Words

Solve

You are given a string s and an array of strings words. All the strings of words are of the same length.

HardVery Likely
hash-tablestringsliding-window

Count Prefix and Suffix Pairs II

Solve

You are given a 0-indexed string array words.

HardVery Likely
arraystringtrie

Find the Width of Columns of a Grid

Solve

You are given a 0-indexed m x n integer matrix grid. The width of a column is the maximum length of its integers.

EasyVery Likely
arraymatrix

Minimum Number of Operations to Make String Sorted

Solve

You are given a string s (0-indexed)​​​​​​. You are asked to perform the following operation on s​​​​​​ until you get a sorted string:

HardVery Likely
hash-tablemathstring

Stone Game IX

Solve

Alice and Bob continue their games with stones. There is a row of n stones, and each stone has an associated value. You are given an integer array stones, where...

MediumVery Likely
arraymathgreedy

Design Graph With Shortest Path Calculator

Solve

There is a directed weighted graph that consists of n nodes numbered from 0 to n - 1. The edges of the graph are initially represented by the given array edges...

HardVery Likely
graphdesignheap-priority-queue

Guess Number Higher or Lower

Solve

We are playing the Guess Game. The game is as follows:

EasyVery Likely
binary-searchinteractive

Largest 1-Bordered Square

Solve

Given a 2D grid of 0s and 1s, return the number of elements in the largest square subgrid that has all 1s on its border, or 0 if such a subgrid doesn't exist in...

MediumVery Likely
arraydynamic-programmingmatrix

Two Sum IV - Input is a BST

Solve

Given the root of a binary search tree and an integer k, return true if there exist two elements in the BST such that their sum is equal to k, or false otherwis...

EasyVery Likely
hash-tabletwo-pointerstree

Maximum Product of Two Elements in an Array

Solve

Given the array of integers nums, you will choose two different indices i and j of that array. Return the maximum value of (nums[i]-1)(nums[j]-1).

EasyVery Likely
arraysortingheap-priority-queue

Mark Elements on Array by Performing Queries

Solve

You are given a 0-indexed array nums of size n consisting of positive integers.

MediumVery Likely
arrayhash-tablesorting

Best Time to Buy and Sell Stock

Solve

You are given an array prices where prices[i] is the price of a given stock on the ith day.

EasyVery Likely
arraydynamic-programming

Is Graph Bipartite?

Solve

There is an undirected graph with n nodes, where each node is numbered between 0 and n - 1. You are given a 2D array graph, where graph[u] is an array of nodes...

MediumLikely
depth-first-searchbreadth-first-searchunion-find

Maximize Distance to Closest Person

Solve

You are given an array representing a row of seats where seats[i] = 1 represents a person sitting in the ith seat, and seats[i] = 0 represents that the ith seat...

MediumLikely
array

Two Sum

Solve

Given an array of integers nums and an integer target, return the indices of the two numbers that add up to target.

EasyLikely
arrayhash-map

Maximum Subarray

Solve

Given an integer array nums, find the subarray with the largest sum, and return its sum.

MediumLikely
arraydivide-and-conquerdynamic-programming

3Sum

Solve

Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.

MediumLikely
arraytwo-pointerssorting

Rotting Oranges

Solve

You are given an m x n grid where each cell can have one of three values:

MediumLikely
arraybreadth-first-searchmatrix

Possible Bipartition

Solve

We want to split a group of n people (labeled from 1 to n) into two groups of any size. Each person may dislike some other people, and they should not go into t...

MediumLikely
depth-first-searchbreadth-first-searchunion-find

Palindrome Number

Solve

Given an integer x, return true if x is a palindrome, and false otherwise.

EasyLikely
math

Make Sum Divisible by P

Solve

Given an array of positive integers nums, remove the smallest subarray (possibly empty) such that the sum of the remaining elements is divisible by p. It is not...

MediumLikely
arrayhash-tableprefix-sum

Coin Change

Solve

You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money.

MediumLikely
arraydynamic-programmingbreadth-first-search

Add Two Numbers

Solve

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a sing...

MediumLikely
linked-listmathrecursion

Merge Intervals

Solve

Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cove...

MediumLikely
arraysorting

Subarray Product Less Than K

Solve

Given an array of integers nums and an integer k, return the number of contiguous subarrays where the product of all the elements in the subarray is strictly le...

MediumLikely
arraybinary-searchsliding-window

Word Search

Solve

Given an m x n grid of characters board and a string word, return true if word exists in the grid.

MediumLikely
arraystringbacktracking

Valid Parentheses

Solve

Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

EasyLikely
stringstack

Merge k Sorted Lists

Solve

You are given an array of k linked-lists lists, each linked-list is sorted in ascending order.

HardSometimes
linked-listdivide-and-conquerheap-priority-queue

Linked List Cycle

Solve

Given head, the head of a linked list, determine if the linked list has a cycle in it.

EasySometimes
hash-tablelinked-listtwo-pointers

First Missing Positive

Solve

Given an unsorted integer array nums. Return the smallest positive integer that is not present in nums.

HardSometimes
arrayhash-table

Word Ladder

Solve

A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s1 -> s2 -> ... -> sk such that:

HardSometimes
hash-tablestringbreadth-first-search

Sort Colors

Solve

Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order...

MediumSometimes
arraytwo-pointerssorting

Remove K Digits

Solve

Given string num representing a non-negative integer num, and an integer k, return the smallest possible integer after removing k digits from num.

MediumSometimes
stringstackgreedy

Jump Game II

Solve

You are given a 0-indexed array of integers nums of length n. You are initially positioned at index 0.

MediumSometimes
arraydynamic-programminggreedy

Subsets

Solve

Given an integer array nums of unique elements, return all possible subsets (the power set).

MediumSometimes
arraybacktrackingbit-manipulation

K-th Smallest in Lexicographical Order

Solve

Given two integers n and k, return the kth lexicographically smallest integer in the range [1, n].

HardSometimes
trie

Search in Rotated Sorted Array

Solve

There is an integer array nums sorted in ascending order (with distinct values).

MediumSometimes
arraybinary-search

All Nodes Distance K in Binary Tree

Solve

Given the root of a binary tree, the value of a target node target, and an integer k, return an array of the values of all nodes that have a distance k from the...

MediumSometimes
hash-tabletreedepth-first-search

Robot Collisions

Solve

There are n 1-indexed robots, each having a position on a line, health, and movement direction.

HardSometimes
arraystacksorting

Largest Submatrix With Rearrangements

Solve

You are given a binary matrix matrix of size m x n, and you are allowed to rearrange the columns of the matrix in any order.

MediumSometimes
arraygreedysorting

Sqrt(x)

Solve

Given a non-negative integer x, return the square root of x rounded down to the nearest integer. The returned integer should be non-negative as well.

EasySometimes
mathbinary-search

Lowest Common Ancestor of a Binary Search Tree

Solve

Given a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in the BST.

MediumSometimes
treedepth-first-searchbinary-search-tree

Reverse Linked List

Solve

Given the head of a singly linked list, reverse the list, and return the reversed list.

EasySometimes
linked-listrecursion

Container With Most Water

Solve

You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]).

MediumSometimes
arraytwo-pointersgreedy

Longest Common Prefix

Solve

Write a function to find the longest common prefix string amongst an array of strings.

EasySometimes
arraystringtrie

Longest Palindromic Substring

Solve

Given a string s, return the longest palindromic substring in s.

MediumSometimes
two-pointersstringdynamic-programming

Reverse Integer

Solve

Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-231, 231 - 1...

MediumSometimes
math

Rotate Array

Solve

Given an integer array nums, rotate the array to the right by k steps, where k is non-negative.

MediumSometimes
arraymathtwo-pointers

Convert Sorted Array to Binary Search Tree

Solve

Given an integer array nums where the elements are sorted in ascending order, convert it to a height-balanced binary search tree.

EasySometimes
arraydivide-and-conquertree

Insert Delete GetRandom O(1)

Solve

Implement the RandomizedSet class:

MediumSometimes
arrayhash-tablemath

Unique Binary Search Trees

Solve

Given an integer n, return the number of structurally unique BST's (binary search trees) which has exactly n nodes of unique values from 1 to n.

MediumSometimes
mathdynamic-programmingtree

Find Median from Data Stream

Solve

The median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value, and the median is the mean of the two midd...

HardSometimes
two-pointersdesignsorting

Kth Largest Element in an Array

Solve

Given an integer array nums and an integer k, return the kth largest element in the array.

MediumSometimes
arraydivide-and-conquersorting

N-Queens

Solve

The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other.

HardSometimes
arraybacktracking

Nearest Exit from Entrance in Maze

Solve

You are given an m x n matrix maze (0-indexed) with empty cells (represented as '.') and walls (represented as '+'). You are also given the entrance of the maze...

MediumSometimes
arraybreadth-first-searchmatrix

Binary Tree Maximum Path Sum

Solve

A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequ...

HardSometimes
dynamic-programmingtreedepth-first-search

Implement Trie (Prefix Tree)

Solve

A trie (pronounced as "try") or prefix tree is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various appl...

MediumSometimes
hash-tablestringdesign

4Sum

Solve

Given an array nums of n integers, return an array of all the unique quadruplets [nums[a], nums[b], nums[c], nums[d]] such that:

MediumSometimes
arraytwo-pointerssorting

How often are these problems asked?

Frequency scores are based on crowdsourced interview reports. A higher score means the problem has been reported more often in recent Samsung interviews.

Very Likely

75-100%

Likely

50-74%

Sometimes

25-49%

Rare

0-24%

Preparing for your Samsung coding interview

Samsung interviews focus heavily on array, dynamic-programming, hash-table problems. If you're short on time, these are the categories to prioritize. The problems on this page are sorted by frequency, so start from the top and work your way down.

Beyond solving problems, practice explaining your approach. Samsung interviewers care about your thought process - how you break down a problem, consider edge cases, and evaluate tradeoffs between solutions. A clean O(n) solution you can explain clearly beats an O(log n) solution you can't articulate.

Looking for more companies? Browse all 458 companies in our directory, or sharpen your fundamentals with our free data structure visualizers and AI-powered DSA tutor.

Frequently Asked Questions

What coding problems does Samsung ask in interviews?add

Samsung has been reported to ask 71 distinct coding problems. The most common topics are array, dynamic-programming, hash-table. 14 are Easy difficulty, 38 are Medium, and 19 are Hard. Problems are sorted by frequency - the ones at the top are asked most often.

How hard are Samsung coding interviews?add

Based on 71 reported problems, Samsung interviews are slightly harder than average - 27% Hard vs 18% across all companies. 54% of questions are Medium difficulty. Focus on the high-frequency Medium problems first, then work through the Hard ones.

How should I prepare for a Samsung coding interview?add

Start with the highest-frequency problems listed on this page. Focus on the core topics: array, dynamic-programming, hash-table. Practice solving them under time pressure and explaining your approach out loud. Mock interviews with AI can simulate the real experience.

Other companies to explore

Ready to ace your Samsung interview?

Simulate a real Samsung coding interview with an AI interviewer. Get a scorecard with specific feedback on your problem-solving, code quality, and communication.

Simulate a Samsung interview with AIarrow_forward