Problem database last updated: June 20, 2025

NNvidia logo

Nvidia Coding Interview Questions

94 problems · 25 Easy, 57 Medium, 12 Hard · Ranked #19 of 458

Difficulty breakdown

25 Easy

27% · avg 23%

57 Medium

61% · avg 59%

12 Hard

13% · avg 18%

Top topics

array
51.1%
hash-table
20.2%
string
19.1%
dynamic-programming
19.1%
math
18.1%
linked-list
14.9%2.1x

Interview profile

Based on 94 reported problems, Nvidia interviews are in line with industry averages - 13% Hard vs 18% overall. The majority (61%) 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, Nvidia puts unusual emphasis on geometry (4.3% of problems, 7.9x the industry average), hash-function (2.1% of problems, 3.7x the industry average), randomized (3.2% of problems, 3.4x the industry average). If you're short on time, these are the categories to double down on.

The most common topics are array (51.1%), hash-table (20.2%), string (19.1%), dynamic-programming (19.1%). Problems below are sorted by frequency, the ones at the top are asked most often.

All 94 problems

Last Stone Weight

Solve

You are given an array of integers stones where stones[i] is the weight of the ith stone.

EasyVery Likely
arrayheap-priority-queue

LRU Cache

Solve

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

MediumVery Likely
hash-tablelinked-listdesign

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

Minimum Operations to Reduce an Integer to 0

Solve

You are given a positive integer n, you can do the following operation any number of times:

MediumVery Likely
dynamic-programminggreedybit-manipulation

Special Binary String

Solve

Special binary strings are binary strings with the following two properties:

HardVery Likely
stringdivide-and-conquersorting

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

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.

EasyVery Likely
arrayhash-map

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

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

Maximum Subarray

Solve

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

MediumVery Likely
arraydivide-and-conquerdynamic-programming

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

MediumVery Likely
linked-listmathrecursion

Search in Rotated Sorted Array

Solve

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

MediumVery Likely
arraybinary-search

Maximum Number of Visible Points

Solve

You are given an array points, an integer angle, and your location, where location = [posx, posy] and points[i] = [xi, yi] both denote integral coordinates on t...

HardVery Likely
arraymathgeometry

Reverse Bits

Solve

Reverse bits of a given 32 bits signed integer.

EasyVery Likely
divide-and-conquerbit-manipulation

Missing Number

Solve

Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from the array.

EasyLikely
arrayhash-tablemath

Valid Parentheses

Solve

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

EasyLikely
stringstack

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

Task Scheduler II

Solve

You are given a 0-indexed array of positive integers tasks, representing tasks that need to be completed in order, where tasks[i] represents the type of the ith...

MediumLikely
arrayhash-tablesimulation

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

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.

EasyLikely
arraytwo-pointers

Rotate Image

Solve

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

MediumLikely
arraymathmatrix

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

HardLikely
two-pointersdesignsorting

Copy List with Random Pointer

Solve

A linked list of length n is given such that each node contains an additional random pointer, which could point to any node in the list, or null.

MediumLikely
hash-tablelinked-list

Fibonacci Number

Solve

The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, startin...

EasyLikely
mathdynamic-programmingrecursion

String to Integer (atoi)

Solve

Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer.

MediumLikely
string

Climbing Stairs

Solve

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

EasyLikely
mathdynamic-programmingmemoization

Kth Largest Element in an Array

Solve

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

MediumLikely
arraydivide-and-conquersorting

Break a Palindrome

Solve

Given a palindromic string of lowercase English letters palindrome, replace exactly one character with any lowercase English letter so that the resulting string...

MediumLikely
stringgreedy

Insert Delete GetRandom O(1)

Solve

Implement the RandomizedSet class:

MediumLikely
arrayhash-tablemath

Rectangle Area

Solve

Given the coordinates of two rectilinear rectangles in a 2D plane, return the total area covered by the two rectangles.

MediumLikely
mathgeometry

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 the Duplicate Number

Solve

Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive.

MediumLikely
arraytwo-pointersbinary-search

Generate Parentheses

Solve

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

MediumLikely
stringdynamic-programmingbacktracking

H-Index

Solve

Given an array of integers citations where citations[i] is the number of citations a researcher received for their ith paper, return the researcher's h-index.

MediumLikely
arraysortingcounting-sort

Maximal Square

Solve

Given an m x n binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.

MediumLikely
arraydynamic-programmingmatrix

Single Element in a Sorted Array

Solve

You are given a sorted array consisting of only integers where every element appears exactly twice, except for one element which appears exactly once.

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

Spiral Matrix

Solve

Given an m x n matrix, return all elements of the matrix in spiral order.

MediumLikely
arraymatrixsimulation

Intersection of Two Linked Lists

Solve

Given the heads of two singly linked-lists headA and headB, return the node at which the two lists intersect. If the two linked lists have no intersection at al...

EasyLikely
hash-tablelinked-listtwo-pointers

Reverse Linked List II

Solve

Given the head of a singly linked list and two integers left and right where left <= right, reverse the nodes of the list from position left to position right,...

MediumLikely
linked-list

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

Snapshot Array

Solve

Implement a SnapshotArray that supports the following interface:

MediumLikely
arrayhash-tablebinary-search

Sliding Puzzle

Solve

On an 2 x 3 board, there are five tiles labeled from 1 to 5, and an empty square represented by 0. A move consists of choosing 0 and a 4-directionally adjacent...

HardLikely
arraydynamic-programmingbacktracking

Delete Duplicate Folders in System

Solve

Due to a bug, there are many duplicate folders in a file system. You are given a 2D array paths, where paths[i] is an array representing an absolute path to the...

HardLikely
arrayhash-tablestring

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

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

EasySometimes
arraytwo-pointerssorting

Longest Common Prefix

Solve

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

EasySometimes
arraystringtrie

Majority Element

Solve

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

EasySometimes
arrayhash-tabledivide-and-conquer

Find Peak Element

Solve

A peak element is an element that is strictly greater than its neighbors.

MediumSometimes
arraybinary-search

House Robber

Solve

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from rob...

MediumSometimes
arraydynamic-programming

Reverse Linked List

Solve

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

EasySometimes
linked-listrecursion

Set Matrix Zeroes

Solve

Given an m x n integer matrix matrix, if an element is 0, set its entire row and column to 0's.

MediumSometimes
arrayhash-tablematrix

Find Pivot Index

Solve

Given an array of integers nums, calculate the pivot index of this array.

EasySometimes
arrayprefix-sum

Course Schedule II

Solve

There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, b...

MediumSometimes
depth-first-searchbreadth-first-searchgraph

Best Time to Buy and Sell Stock IV

Solve

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

HardSometimes
arraydynamic-programming

Design HashMap

Solve

Design a HashMap without using any built-in hash table libraries.

EasySometimes
arrayhash-tablelinked-list

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

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

MediumSometimes
arraybinary-searchsliding-window

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

Max Points on a Line

Solve

Given an array of points where points[i] = [xi, yi] represents a point on the X-Y plane, return the maximum number of points that lie on the same straight line.

HardSometimes
arrayhash-tablemath

Serialize and Deserialize Binary Tree

Solve

Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitte...

HardSometimes
stringtreedepth-first-search

Ways to Make a Fair Array

Solve

You are given an integer array nums. You can choose exactly one index (0-indexed) and remove the element. Notice that the index of the elements may change after...

MediumSometimes
arrayprefix-sum

Keys and Rooms

Solve

There are n rooms labeled from 0 to n - 1 and all the rooms are locked except for room 0. Your goal is to visit all the rooms. However, you cannot enter a locke...

MediumSometimes
depth-first-searchbreadth-first-searchgraph

Maximum Sum of Distinct Subarrays With Length K

Solve

You are given an integer array nums and an integer k. Find the maximum subarray sum of all the subarrays of nums that meet the following conditions:

MediumSometimes
arrayhash-tablesliding-window

Find The Original Array of Prefix Xor

Solve

You are given an integer array pref of size n. Find and return the array arr of size n that satisfies:

MediumSometimes
arraybit-manipulation

Shuffle an Array

Solve

Given an integer array nums, design an algorithm to randomly shuffle the array. All permutations of the array should be equally likely as a result of the shuffl...

MediumSometimes
arraymathdesign

Double a Number Represented as a Linked List

Solve

You are given the head of a non-empty linked list representing a non-negative integer without leading zeroes.

MediumSometimes
linked-listmathstack

Minimum Add to Make Parentheses Valid

Solve

A parentheses string is valid if and only if:

MediumSometimes
stringstackgreedy

Counting Bits

Solve

Given an integer n, return an array ans of length n + 1 such that for each i (0 <= i <= n), ans[i] is the number of 1's in the binary representation of i.

EasySometimes
dynamic-programmingbit-manipulation

Linked List Random Node

Solve

Given a singly linked list, return a random node's value from the linked list. Each node must have the same probability of being chosen.

MediumSometimes
linked-listmathreservoir-sampling

Number of Operations to Make Network Connected

Solve

There are n computers numbered from 0 to n - 1 connected by ethernet cables connections forming a network where connections[i] = [ai, bi] represents a connectio...

MediumSometimes
depth-first-searchbreadth-first-searchunion-find

Greatest Common Divisor of Strings

Solve

For two strings s and t, we say "t divides s" if and only if s = t + t + t + ... + t + t (i.e., t is concatenated with itself one or more times).

EasySometimes
mathstring

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

MediumSometimes
arraybinary-searchsliding-window

Remove Nth Node From End of List

Solve

Given the head of a linked list, remove the nth node from the end of the list and return its head.

MediumSometimes
linked-listtwo-pointers

Rectangle Overlap

Solve

An axis-aligned rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) is the coordinate of its bottom-left corner, and (x2, y2) is the coordinate...

EasySometimes
mathgeometry

Valid Sudoku

Solve

Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:

MediumSometimes
arrayhash-tablematrix

Is Subsequence

Solve

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

EasySometimes
two-pointersstringdynamic-programming

Sort Characters By Frequency

Solve

Given a string s, sort it in decreasing order based on the frequency of the characters. The frequency of a character is the number of times it appears in the st...

MediumSometimes
hash-tablestringsorting

Remove Duplicates from Sorted List

Solve

Given the head of a sorted linked list, delete all duplicates such that each element appears only once. Return the linked list sorted as well.

EasySometimes
linked-list

Maximum Product Subarray

Solve

Given an integer array nums, find a subarray that has the largest product, and return the product.

MediumSometimes
arraydynamic-programming

Range Sum Query 2D - Immutable

Solve

Given a 2D matrix matrix, handle multiple queries of the following type:

MediumSometimes
arraydesignmatrix

Swapping Nodes in a Linked List

Solve

You are given the head of a linked list, and an integer k.

MediumSometimes
linked-listtwo-pointers

Print in Order

Solve

Suppose we have a class:

EasySometimes
concurrency

Course Schedule

Solve

There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, b...

MediumSometimes
depth-first-searchbreadth-first-searchgraph

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.

MediumSometimes
arraydynamic-programmingbreadth-first-search

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

Fizz Buzz

Solve

Given an integer n, return a string array answer (1-indexed) where:

EasySometimes
mathstringsimulation

Robot Bounded In Circle

Solve

On an infinite plane, a robot initially stands at (0, 0) and faces north. Note that:

MediumSometimes
mathstringsimulation

Delete Node in a Linked List

Solve

There is a singly-linked list head and we want to delete a node node in it.

MediumSometimes
linked-list

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.

MediumSometimes
arraytwo-pointerssorting

Validate IP Address

Solve

Given a string queryIP, return "IPv4" if IP is a valid IPv4 address, "IPv6" if IP is a valid IPv6 address or "Neither" if IP is not a correct IP of any type.

MediumSometimes
string

Min Stack

Solve

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

MediumSometimes
stackdesign

All Possible Full Binary Trees

Solve

Given an integer n, return a list of all possible full binary trees with n nodes. Each node of each tree in the answer must have Node.val == 0.

MediumSometimes
dynamic-programmingtreerecursion

Longest Increasing Path in a Matrix

Solve

Given an m x n integers matrix, return the length of the longest increasing path in matrix.

HardSometimes
arraydynamic-programmingdepth-first-search

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

Very Likely

75-100%

Likely

50-74%

Sometimes

25-49%

Rare

0-24%

Preparing for your Nvidia coding interview

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

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

How hard are Nvidia coding interviews?add

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

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

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

Simulate a Nvidia interview with AIarrow_forward