Problem database last updated: June 20, 2025

OOracle logo

Oracle Coding Interview Questions

100 problems · 25 Easy, 59 Medium, 16 Hard · Ranked #8 of 458

Difficulty breakdown

25 Easy

25% · avg 23%

59 Medium

59% · avg 59%

16 Hard

16% · avg 18%

Top topics

array
50%
string
23%
hash-table
22%
dynamic-programming
19%
linked-list
14%1.9x
two-pointers
14%

Interview profile

Based on 100 reported problems, Oracle interviews are in line with industry averages - 16% Hard vs 18% overall. The majority (59%) 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, Oracle puts unusual emphasis on binary-search-tree (3% of problems, 2.7x the industry average), merge-sort (2% of problems, 2.7x the industry average), queue (3% of problems, 2.1x the industry average). If you're short on time, these are the categories to double down on.

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

All 100 problems

LRU Cache

Solve

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

MediumVery Likely
hash-tablelinked-listdesign

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

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

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

Longest Palindromic Substring

Solve

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

MediumVery Likely
two-pointersstringdynamic-programming

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

Search in Rotated Sorted Array

Solve

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

MediumLikely
arraybinary-search

Sliding Window Maximum

Solve

You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see...

HardLikely
arrayqueuesliding-window

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

MediumLikely
arraytwo-pointersgreedy

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

Longest Consecutive Sequence

Solve

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

MediumLikely
arrayhash-tableunion-find

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

Spiral Matrix

Solve

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

MediumLikely
arraymatrixsimulation

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

Reverse Linked List

Solve

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

EasyLikely
linked-listrecursion

Merge Two Sorted Lists

Solve

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

EasyLikely
linked-listrecursion

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

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

MediumLikely
depth-first-searchbreadth-first-searchgraph

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

Roman to Integer

Solve

Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.

EasyLikely
hash-tablemathstring

Pow(x, n)

Solve

Implement pow(x, n), which calculates x raised to the power n (i.e., xn).

MediumLikely
mathrecursion

Jump Game

Solve

You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your maximum jump length...

MediumLikely
arraydynamic-programminggreedy

Gas Station

Solve

There are n gas stations along a circular route, where the amount of gas at the ith station is gas[i].

MediumLikely
arraygreedy

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

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

MediumLikely
depth-first-searchbreadth-first-searchgraph

Search a 2D Matrix II

Solve

Write an efficient algorithm that searches for a value target in an m x n integer matrix matrix. This matrix has the following properties:

MediumLikely
arraybinary-searchdivide-and-conquer

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

MediumLikely
treebreadth-first-searchbinary-tree

First Missing Positive

Solve

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

HardLikely
arrayhash-table

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

Longest Common Prefix

Solve

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

EasyLikely
arraystringtrie

Maximum Subarray

Solve

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

MediumLikely
arraydivide-and-conquerdynamic-programming

Min Stack

Solve

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

MediumLikely
stackdesign

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

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

MediumLikely
arrayprefix-sum

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.

MediumLikely
arrayhash-tablematrix

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

Restore IP Addresses

Solve

A valid IP address consists of exactly four integers separated by single dots. Each integer is between 0 and 255 (inclusive) and cannot have leading zeros.

MediumLikely
stringbacktracking

Combination Sum

Solve

Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum...

MediumLikely
arraybacktracking

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

Linked List Cycle

Solve

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

EasyLikely
hash-tablelinked-listtwo-pointers

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

Valid Anagram

Solve

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

EasyLikely
hash-tablestringsorting

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

MediumLikely
arraytwo-pointerssorting

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

Find First and Last Position of Element in Sorted Array

Solve

Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value.

MediumLikely
arraybinary-search

Zigzag Conversion

Solve

The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better...

MediumLikely
string

Generate Parentheses

Solve

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

MediumLikely
stringdynamic-programmingbacktracking

Delete Node in a Linked List

Solve

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

MediumLikely
linked-list

Jump Game II

Solve

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

MediumLikely
arraydynamic-programminggreedy

Letter Combinations of a Phone Number

Solve

Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order.

MediumSometimes
hash-tablestringbacktracking

Rotate Image

Solve

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

MediumSometimes
arraymathmatrix

Remove Duplicates from Sorted Array

Solve

Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once. The relative order o...

EasySometimes
arraytwo-pointers

Isomorphic Strings

Solve

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

EasySometimes
hash-tablestring

Majority Element

Solve

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

EasySometimes
arrayhash-tabledivide-and-conquer

Combination Sum II

Solve

Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sum to...

MediumSometimes
arraybacktracking

Integer to Roman

Solve

Seven different symbols represent Roman numerals with the following values:

MediumSometimes
hash-tablemathstring

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

Kth Smallest Element in a BST

Solve

Given the root of a binary search tree, and an integer k, return the kth smallest value (1-indexed) of all the values of the nodes in the tree.

MediumSometimes
treedepth-first-searchbinary-search-tree

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.

MediumSometimes
hash-tablelinked-list

Word Break II

Solve

Given a string s and a dictionary of strings wordDict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possi...

HardSometimes
arrayhash-tablestring

Longest Valid Parentheses

Solve

Given a string containing just the characters '(' and ')', return the length of the longest valid (well-formed) parentheses substring.

HardSometimes
stringdynamic-programmingstack

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

Permutations

Solve

Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order.

MediumSometimes
arraybacktracking

Largest Number

Solve

Given a list of non-negative integers nums, arrange them such that they form the largest number and return it.

MediumSometimes
arraystringgreedy

Decode Ways

Solve

You have intercepted a secret message encoded as a string of numbers. The message is decoded via the following mapping:

MediumSometimes
stringdynamic-programming

Sudoku Solver

Solve

Write a program to solve a Sudoku puzzle by filling the empty cells.

HardSometimes
arrayhash-tablebacktracking

Insert Interval

Solve

You are given an array of non-overlapping intervals intervals where intervals[i] = [starti, endi] represent the start and the end of the ith interval and interv...

MediumSometimes
array

Rotate List

Solve

Given the head of a linked list, rotate the list to the right by k places.

MediumSometimes
linked-listtwo-pointers

Regular Expression Matching

Solve

Given an input string s and a pattern p, implement regular expression matching with support for '.' and '' where:

HardSometimes
stringdynamic-programmingrecursion

Find Peak Element

Solve

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

MediumSometimes
arraybinary-search

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

Invert Binary Tree

Solve

Given the root of a binary tree, invert the tree, and return its root.

EasySometimes
treedepth-first-searchbreadth-first-search

Palindrome Number

Solve

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

EasySometimes
math

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

Populating Next Right Pointers in Each Node

Solve

You are given a perfect binary tree where all leaves are on the same level, and every parent has two children. The binary tree has the following definition:

MediumSometimes
linked-listtreedepth-first-search

Unique Paths

Solve

There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-right corner...

MediumSometimes
mathdynamic-programmingcombinatorics

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

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

Palindrome Linked List

Solve

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

EasySometimes
linked-listtwo-pointersstack

Sort List

Solve

Given the head of a linked list, return the list after sorting it in ascending order.

MediumSometimes
linked-listtwo-pointersdivide-and-conquer

Basic Calculator

Solve

Given a string s representing a valid expression, implement a basic calculator to evaluate it, and return the result of the evaluation.

HardSometimes
mathstringstack

Find Subsequence of Length K With the Largest Sum

Solve

You are given an integer array nums and an integer k. You want to find a subsequence of nums of length k that has the largest sum.

EasySometimes
arrayhash-tablesorting

Path Sum II

Solve

Given the root of a binary tree and an integer targetSum, return all root-to-leaf paths where the sum of the node values in the path equals targetSum. Each path...

MediumSometimes
backtrackingtreedepth-first-search

Implement Queue using Stacks

Solve

Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (push, peek, pop, an...

EasySometimes
stackdesignqueue

Count Number of Pairs With Absolute Difference K

Solve

Given an integer array nums and an integer k, return the number of pairs (i, j) where i < j such that |nums[i] - nums[j]| == k.

EasySometimes
arrayhash-tablecounting

Text Justification

Solve

Given an array of strings words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justifie...

HardSometimes
arraystringsimulation

Excel Sheet Column Title

Solve

Given an integer columnNumber, return its corresponding column title as it appears in an Excel sheet.

EasySometimes
mathstring

Number of Unique Good Subsequences

Solve

You are given a binary string binary. A subsequence of binary is considered good if it is not empty and has no leading zeros (with the exception of "0").

HardSometimes
stringdynamic-programming

Implement Stack using Queues

Solve

Implement a last-in-first-out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal stack (push, top, pop, and...

EasySometimes
stackdesignqueue

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

HardSometimes
hash-tablestringsliding-window

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

EasySometimes
hash-tablelinked-listtwo-pointers

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

Climbing Stairs

Solve

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

EasySometimes
mathdynamic-programmingmemoization

Pascal's Triangle

Solve

Given an integer numRows, return the first numRows of Pascal's triangle.

EasySometimes
arraydynamic-programming

Delete Duplicate Emails

Solve

Table: Person

EasySometimes
database

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

Maximum Product Subarray

Solve

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

MediumSometimes
arraydynamic-programming

Maximal Rectangle

Solve

Given a rows x cols binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area.

HardSometimes
arraydynamic-programmingstack

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

Very Likely

75-100%

Likely

50-74%

Sometimes

25-49%

Rare

0-24%

Preparing for your Oracle coding interview

Oracle 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. Oracle 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 Oracle ask in interviews?add

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

How hard are Oracle coding interviews?add

Based on 100 reported problems, Oracle interviews are in line with industry averages - 16% Hard vs 18% overall. 59% 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 Oracle 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 Oracle interview?

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

Simulate a Oracle interview with AIarrow_forward