Problem database last updated: June 20, 2025

SSAP logo

SAP Coding Interview Questions

38 problems · 15 Easy, 17 Medium, 6 Hard · Ranked #54 of 458

Difficulty breakdown

15 Easy

39% · avg 23%

17 Medium

45% · avg 59%

6 Hard

16% · avg 18%

Top topics

array
63.2%
dynamic-programming
28.9%1.5x
two-pointers
18.4%
string
18.4%
hash-table
15.8%
math
13.2%

Interview profile

Based on 38 reported problems, SAP interviews are in line with industry averages - 16% Hard vs 18% overall.

Compared to the industry average, SAP puts unusual emphasis on memoization (5.3% of problems, 3.2x the industry average), trie (5.3% of problems, 2x the industry average), graph (5.3% of problems, 1.8x the industry average). If you're short on time, these are the categories to double down on.

The most common topics are array (63.2%), dynamic-programming (28.9%), two-pointers (18.4%), string (18.4%). Problems below are sorted by frequency, the ones at the top are asked most often.

All 38 problems

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

Count the Number of Infection Sequences

Solve

You are given an integer n and an array sick sorted in increasing order, representing positions of infected people in a line of n people.

HardVery Likely
arraymathcombinatorics

Movie Rating

Solve

Table: Movies

MediumVery Likely
database

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

MediumVery Likely
arraytwo-pointersgreedy

Maximum Students Taking Exam

Solve

Given a m n matrix seats that represent seats distributions in a classroom. If a seat is broken, it is denoted by '' character otherwise it is denoted by a '.'...

HardVery Likely
arraydynamic-programmingbit-manipulation

Maximum Path Quality of a Graph

Solve

There is an undirected graph with n nodes numbered from 0 to n - 1 (inclusive). You are given a 0-indexed integer array values where values[i] is the value of t...

HardVery Likely
arraybacktrackinggraph

Count Increasing Quadruplets

Solve

Given a 0-indexed integer array nums of size n containing all numbers from 1 to n, return the number of increasing quadruplets.

HardVery Likely
arraydynamic-programmingbinary-indexed-tree

Longest Common Prefix

Solve

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

EasyVery Likely
arraystringtrie

Valid Parentheses

Solve

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

EasyVery Likely
stringstack

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

Reverse Linked List

Solve

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

EasyLikely
linked-listrecursion

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

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

EasyLikely
two-pointersstring

Maximum Subarray

Solve

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

MediumLikely
arraydivide-and-conquerdynamic-programming

Rotate String

Solve

Given two strings s and goal, return true if and only if s can become goal after some number of shifts on s.

EasyLikely
stringstring-matching

Longest Consecutive Sequence

Solve

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

MediumLikely
arrayhash-tableunion-find

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

EasyLikely
arraytwo-pointers

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

Daily Temperatures

Solve

Given an array of integers temperatures represents the daily temperatures, return an array answer such that answer[i] is the number of days you have to wait aft...

MediumLikely
arraystackmonotonic-stack

Maximum Number of Weeks for Which You Can Work

Solve

There are n projects numbered from 0 to n - 1. You are given an integer array milestones where each milestones[i] denotes the number of milestones the ith proje...

MediumLikely
arraygreedy

Longest Palindromic Substring

Solve

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

MediumLikely
two-pointersstringdynamic-programming

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

Monotone Increasing Digits

Solve

An integer has monotone increasing digits if and only if each pair of adjacent digits x and y satisfy x <= y.

MediumLikely
mathgreedy

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

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

Sort Array by Increasing Frequency

Solve

Given an array of integers nums, sort the array in increasing order based on the frequency of the values. If multiple values have the same frequency, sort them...

EasyLikely
arrayhash-tablesorting

Maximum Depth of Binary Tree

Solve

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

EasyLikely
treedepth-first-searchbreadth-first-search

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.

EasyLikely
mathbinary-search

Group Anagrams

Solve

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

MediumLikely
arrayhash-tablestring

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

LRU Cache

Solve

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

MediumLikely
hash-tablelinked-listdesign

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

Maximum Employees to Be Invited to a Meeting

Solve

A company is organizing a meeting and has a list of n employees, waiting to be invited. They have arranged for a large circular table, capable of seating any nu...

HardLikely
arraydynamic-programmingdepth-first-search

Word Break

Solve

Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words.

MediumLikely
arrayhash-tablestring

Binary Search Tree to Greater Sum Tree

Solve

Given the root of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus the sum o...

MediumLikely
treedepth-first-searchbinary-search-tree

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

Valid Perfect Square

Solve

Given a positive integer num, return true if num is a perfect square or false otherwise.

EasyLikely
mathbinary-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 SAP interviews.

Very Likely

75-100%

Likely

50-74%

Sometimes

25-49%

Rare

0-24%

Preparing for your SAP coding interview

SAP interviews focus heavily on array, dynamic-programming, two-pointers 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. SAP 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 SAP ask in interviews?add

SAP has been reported to ask 38 distinct coding problems. The most common topics are array, dynamic-programming, two-pointers. 15 are Easy difficulty, 17 are Medium, and 6 are Hard. Problems are sorted by frequency - the ones at the top are asked most often.

How hard are SAP coding interviews?add

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

Start with the highest-frequency problems listed on this page. Focus on the core topics: array, dynamic-programming, two-pointers. 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 SAP interview?

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

Simulate a SAP interview with AIarrow_forward