Problem database last updated: June 20, 2025

YYandex logo

Yandex Coding Interview Questions

94 problems · 34 Easy, 51 Medium, 9 Hard · Ranked #21 of 458

Difficulty breakdown

34 Easy

36% · avg 23%

51 Medium

54% · avg 59%

9 Hard

10% · avg 18%

Top topics

array
54.3%
string
27.7%
hash-table
27.7%
two-pointers
22.3%1.6x
sorting
18.1%
dynamic-programming
12.8%

Interview profile

Based on 94 reported problems, Yandex interviews are in line with industry averages - 10% Hard vs 18% overall. 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, Yandex puts unusual emphasis on bucket-sort (3.2% of problems, 4.1x the industry average), sliding-window (11.7% of problems, 2.5x the industry average), binary-tree (10.6% of problems, 2.2x the industry average). If you're short on time, these are the categories to double down on.

The most common topics are array (54.3%), string (27.7%), hash-table (27.7%), two-pointers (22.3%). Problems below are sorted by frequency, the ones at the top are asked most often.

All 94 problems

Longest Subarray of 1's After Deleting One Element

Solve

Given a binary array nums, you should delete one element from it.

MediumVery Likely
arraydynamic-programmingsliding-window

Summary Ranges

Solve

You are given a sorted unique integer array nums.

EasyVery Likely
array

String Compression

Solve

Given an array of characters chars, compress it using the following algorithm:

MediumVery Likely
two-pointersstring

Find K Closest Elements

Solve

Given a sorted integer array arr, two integers k and x, return the k closest integers to x in the array. The result should also be sorted in ascending order.

MediumVery Likely
arraytwo-pointersbinary-search

Isomorphic Strings

Solve

Given two strings s and t, determine if they are isomorphic.

EasyVery Likely
hash-tablestring

Subarray Sum Equals K

Solve

Given an array of integers nums and an integer k, return the total number of subarrays whose sum equals to k.

MediumVery Likely
arrayhash-tableprefix-sum

Permutation in String

Solve

Given two strings s1 and s2, return true if s2 contains a permutation of s1, or false otherwise.

MediumVery Likely
hash-tabletwo-pointersstring

Valid Palindrome

Solve

A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forwa...

EasyVery Likely
two-pointersstring

Insert Delete GetRandom O(1)

Solve

Implement the RandomizedSet class:

MediumVery Likely
arrayhash-tablemath

Move Zeroes

Solve

Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements.

EasyVery Likely
arraytwo-pointers

Longest Substring Without Repeating Characters

Solve

Given a string s, find the length of the longest substring without duplicate characters.

MediumVery Likely
hash-tablestringsliding-window

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...

MediumVery Likely
arraysorting

Group Anagrams

Solve

Given an array of strings strs, group the anagrams together. You can return the answer in any order.

MediumVery Likely
arrayhash-tablestring

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

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.

MediumLikely
arraydepth-first-searchbreadth-first-search

Valid Parentheses

Solve

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

EasyLikely
stringstack

Valid Palindrome II

Solve

Given a string s, return true if the s can be palindrome after deleting at most one character from it.

EasyLikely
two-pointersstringgreedy

Interval List Intersections

Solve

You are given two lists of closed intervals, firstList and secondList, where firstList[i] = [starti, endi] and secondList[j] = [startj, endj]. Each list of inte...

MediumLikely
arraytwo-pointersline-sweep

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.

HardLikely
arraytwo-pointersdynamic-programming

Find All Anagrams in a String

Solve

Given two strings s and p, return an array of all the start indices of p's anagrams in s. You may return the answer in any order.

MediumLikely
hash-tablestringsliding-window

Min Stack

Solve

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.

MediumLikely
stackdesign

Longest Palindromic Substring

Solve

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

MediumLikely
two-pointersstringdynamic-programming

Merge Sorted Array

Solve

You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n, representing the number of elements in nums1 and num...

EasyLikely
arraytwo-pointerssorting

Design an ATM Machine

Solve

There is an ATM machine that stores banknotes of 5 denominations: 20, 50, 100, 200, and 500 dollars. Initially the ATM is empty. The user can use the machine to...

MediumLikely
arraygreedydesign

Generate Parentheses

Solve

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.

MediumLikely
stringdynamic-programmingbacktracking

LRU Cache

Solve

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

MediumLikely
hash-tablelinked-listdesign

Is Subsequence

Solve

Given two strings s and t, return true if s is a subsequence of t, or false otherwise.

EasyLikely
two-pointersstringdynamic-programming

Evaluate Reverse Polish Notation

Solve

You are given an array of strings tokens that represents an arithmetic expression in a Reverse Polish Notation.

MediumLikely
arraymathstack

Merge Two Sorted Lists

Solve

You are given the heads of two sorted linked lists list1 and list2.

EasyLikely
linked-listrecursion

Validate Binary Search Tree

Solve

Given the root of a binary tree, determine if it is a valid binary search tree (BST).

MediumLikely
treedepth-first-searchbinary-search-tree

Minimum Window Substring

Solve

Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicates) is inc...

HardLikely
hash-tablestringsliding-window

Binary Tree Right Side View

Solve

Given the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.

MediumLikely
treedepth-first-searchbreadth-first-search

Destination City

Solve

You are given the array paths, where paths[i] = [cityAi, cityBi] means there exists a direct path going from cityAi to cityBi. Return the destination city, that...

EasyLikely
arrayhash-tablestring

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.

EasyLikely
arraydynamic-programming

Lowest Common Ancestor of a Binary Tree

Solve

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

MediumLikely
treedepth-first-searchbinary-tree

Find Duplicate Subtrees

Solve

Given the root of a binary tree, return all duplicate subtrees.

MediumLikely
hash-tabletreedepth-first-search

Merge k Sorted Lists

Solve

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

HardLikely
linked-listdivide-and-conquerheap-priority-queue

Simplify Path

Solve

You are given an absolute path for a Unix-style file system, which always begins with a slash '/'. Your task is to transform this absolute path into its simplif...

MediumLikely
stringstack

Max Consecutive Ones III

Solve

Given a binary array nums and an integer k, return the maximum number of consecutive 1's in the array if you can flip at most k 0's.

MediumLikely
arraybinary-searchsliding-window

Reconstruct Itinerary

Solve

You are given a list of airline tickets where tickets[i] = [fromi, toi] represent the departure and the arrival airports of one flight. Reconstruct the itinerar...

HardLikely
arraystringdepth-first-search

Intersection of Two Arrays II

Solve

Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must appear as many times as it shows in both arrays...

EasyLikely
arrayhash-tabletwo-pointers

Symmetric Tree

Solve

Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center).

EasyLikely
treedepth-first-searchbreadth-first-search

Median of Two Sorted Arrays

Solve

Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.

HardLikely
arraybinary-searchdivide-and-conquer

Search in Rotated Sorted Array

Solve

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

MediumLikely
arraybinary-search

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...

HardLikely
dynamic-programmingtreedepth-first-search

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

Single Number

Solve

Given a non-empty array of integers nums, every element appears twice except for one. Find that single one.

EasySometimes
arraybit-manipulation

Remove Element

Solve

Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. The order of the elements may be changed. Then return the number...

EasySometimes
arraytwo-pointers

Max Consecutive Ones

Solve

Given a binary array nums, return the maximum number of consecutive 1's in the array.

EasySometimes
array

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...

MediumSometimes
linked-listmathrecursion

Product of Array Except Self

Solve

Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i].

MediumSometimes
arrayprefix-sum

Candy

Solve

There are n children standing in a line. Each child is assigned a rating value given in the integer array ratings.

HardSometimes
arraygreedy

Continuous Subarray Sum

Solve

Given an integer array nums and an integer k, return true if nums has a good subarray or false otherwise.

MediumSometimes
arrayhash-tablemath

Longest Increasing Subsequence

Solve

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

MediumSometimes
arraybinary-searchdynamic-programming

Intersection of Two Arrays

Solve

Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must be unique and you may return the result in any...

EasySometimes
arrayhash-tabletwo-pointers

Longest Substring with At Least K Repeating Characters

Solve

Given a string s and an integer k, return the length of the longest substring of s such that the frequency of each character in this substring is greater than o...

MediumSometimes
hash-tablestringdivide-and-conquer

Longest Repeating Character Replacement

Solve

You are given a string s and an integer k. You can choose any character of the string and change it to any other uppercase English character. You can perform th...

MediumSometimes
hash-tablestringsliding-window

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

Valid Anagram

Solve

Given two strings s and t, return true if t is an anagram of s, and false otherwise.

EasySometimes
hash-tablestringsorting

Perfect Squares

Solve

Given an integer n, return the least number of perfect square numbers that sum to n.

MediumSometimes
mathdynamic-programmingbreadth-first-search

Find Minimum in Rotated Sorted Array

Solve

Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,2,4,5,6,7] might become:

MediumSometimes
arraybinary-search

Binary Tree Zigzag Level Order Traversal

Solve

Given the root of a binary tree, return the zigzag level order traversal of its nodes' values. (i.e., from left to right, then right to left for the next level...

MediumSometimes
treebreadth-first-searchbinary-tree

Two Sum II - Input Array Is Sorted

Solve

Given a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific target number....

MediumSometimes
arraytwo-pointersbinary-search

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

Best Time to Buy and Sell Stock II

Solve

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

MediumSometimes
arraydynamic-programminggreedy

Palindrome Number

Solve

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

EasySometimes
math

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

First Unique Character in a String

Solve

Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1.

EasySometimes
hash-tablestringqueue

Balanced Binary Tree

Solve

Given a binary tree, determine if it is height-balanced.

EasySometimes
treedepth-first-searchbinary-tree

Top K Frequent Elements

Solve

Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order.

MediumSometimes
arrayhash-tabledivide-and-conquer

Contains Duplicate

Solve

Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.

EasySometimes
arrayhash-tablesorting

Remove Duplicates from Sorted Array II

Solve

Given an integer array nums sorted in non-decreasing order, remove some duplicates in-place such that each unique element appears at most twice. The relative or...

MediumSometimes
arraytwo-pointers

Reverse Linked List

Solve

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

EasySometimes
linked-listrecursion

Can Place Flowers

Solve

You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in adjacent plots.

EasySometimes
arraygreedy

Flatten Nested List Iterator

Solve

You are given a nested list of integers nestedList. Each element is either an integer or a list whose elements may also be integers or other lists. Implement an...

MediumSometimes
stacktreedepth-first-search

Top K Frequent Words

Solve

Given an array of strings words and an integer k, return the k most frequent strings.

MediumSometimes
arrayhash-tablestring

Reverse Words in a String III

Solve

Given a string s, reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.

EasySometimes
two-pointersstring

Sort the Matrix Diagonally

Solve

A matrix diagonal is a diagonal line of cells starting from some cell in either the topmost row or leftmost column and going in the bottom-right direction until...

MediumSometimes
arraysortingmatrix

Palindrome Linked List

Solve

Given the head of a singly linked list, return true if it is a palindrome or false otherwise.

EasyRare
linked-listtwo-pointersstack

Majority Element

Solve

Given an array nums of size n, return the majority element.

EasyRare
arrayhash-tabledivide-and-conquer

Minimum Size Subarray Sum

Solve

Given an array of positive integers nums and a positive integer target, return the minimal length of a subarray whose sum is greater than or equal to target. If...

MediumRare
arraybinary-searchsliding-window

Maximum Depth of Binary Tree

Solve

Given the root of a binary tree, return its maximum depth.

EasyRare
treedepth-first-searchbreadth-first-search

Longest Consecutive Sequence

Solve

Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence.

MediumRare
arrayhash-tableunion-find

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.

MediumRare
arraytwo-pointerssorting

Contains Duplicate III

Solve

You are given an integer array nums and two integers indexDiff and valueDiff.

HardRare
arraysliding-windowsorting

Palindrome Pairs

Solve

You are given a 0-indexed array of unique strings words.

HardRare
arrayhash-tablestring

Climbing Stairs

Solve

You are climbing a staircase. It takes n steps to reach the top.

EasyRare
mathdynamic-programmingmemoization

Find the Difference of Two Arrays

Solve

Given two 0-indexed integer arrays nums1 and nums2, return a list answer of size 2 where:

EasyRare
arrayhash-table

Robot Return to Origin

Solve

There is a robot starting at the position (0, 0), the origin, on a 2D plane. Given a sequence of its moves, judge if this robot ends up at (0, 0) after it compl...

EasyRare
stringsimulation

Path Crossing

Solve

Given a string path, where path[i] = 'N', 'S', 'E' or 'W', each representing moving one unit north, south, east, or west, respectively. You start at the origin...

EasyRare
hash-tablestring

Find the Index of the First Occurrence in a String

Solve

Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.

EasyRare
two-pointersstringstring-matching

Search a 2D Matrix

Solve

You are given an m x n integer matrix matrix with the following two properties:

MediumRare
arraybinary-searchmatrix

Rotate Image

Solve

You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise).

MediumRare
arraymathmatrix

Non-overlapping Intervals

Solve

Given an array of intervals intervals where intervals[i] = [starti, endi], return the minimum number of intervals you need to remove to make the rest of the int...

MediumRare
arraydynamic-programminggreedy

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 Yandex interviews.

Very Likely

75-100%

Likely

50-74%

Sometimes

25-49%

Rare

0-24%

Preparing for your Yandex coding interview

Yandex interviews focus heavily on array, string, 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. Yandex 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 Yandex ask in interviews?add

Yandex has been reported to ask 94 distinct coding problems. The most common topics are array, string, hash-table. 34 are Easy difficulty, 51 are Medium, and 9 are Hard. Problems are sorted by frequency - the ones at the top are asked most often.

How hard are Yandex coding interviews?add

Based on 94 reported problems, Yandex interviews are in line with industry averages - 10% Hard vs 18% overall. 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 Yandex coding interview?add

Start with the highest-frequency problems listed on this page. Focus on the core topics: array, string, 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 Yandex interview?

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

Simulate a Yandex interview with AIarrow_forward