InterviewLegend

Stacks, Queues & Linked Lists

Alex Chen35 min readUpdated 330 real interview reports

Stack, queue and linked list problems at SAP read like a first-year course, and interviewers ask them that way on purpose. They come up across SAP Labs and SAP Ariba, in the second and third technical rounds of Developer Associate interviews and others. Expect shapes like a queue built from two stacks with a one-stack follow-up, a Premium question with brute force first and a stack second, an in-place palindrome check on a linked list, and finding a cycle in a list and then removing it.

None of these needs more than a couple of pointers or one extra stack, so most of your time goes on explaining the cost. Pouring one stack into another looks like O(n) per pop until you show that each element crosses once. A monotonic stack looks quadratic until you show that each index is pushed once and popped at most once. The list problems add a second habit. Write the node class yourself when nobody hands you one, and know which links you're allowed to change. Cutting a cycle rewires exactly one link, and an in-place palindrome check in O(1) space has to put every link back before it returns.

Get a plain version working, then improve it out loud. One candidate reached the hiring manager round with two palindrome answers that both used O(n) memory, a reversed copy and a stack. Another solved a Premium question with a nested scan, named its cost, and then moved to the stack. SAP scores fundamentals you can explain, so a working first answer gives you time to reach the better one.

SAPPremium lesson · Coding round

The 4 SAP problems are below.

  1. A Premium questionCoding · Medium · Frequently asked
  2. A Premium questionCoding · Medium
  3. A Premium questionCoding · Medium

+ 1 more in this lesson

Each with hints, the follow-up and a tested solution.

Get the SAP questions

$49 a year · all 100 companies · cancel anytime

From 330 SAP reports, forum threads behind logins and write-ups in Chinese.

Had your SAP interview?Tell us what they asked. Reviewed before it goes in, never with your name.
SAP interview guide

Know what SAP asks before you walk in.

25 coding · 2 system design · 30 behavioral questions

Get Premium$49 a year · Cancel anytime
Or start freeNo card.

Get their questions first.

InterviewLegend is independent and not affiliated with or endorsed by any company it covers.