YourAlly

Apple Staff coding interview questions

These are the 7 coding questions YourAlly has tagged for Apple at Staff. On the YourAlly ladder this is Staff (E6), the same level as Google L6, Meta E6 and Amazon L7.

A coding round at a large tech company usually runs 45 to 60 minutes with one or two problems. You write code that runs, test it on your own examples and state its time and space cost. At this level interviewers also expect clean code quickly and edge cases you raise before they do.

Practice a mock Apple Staff coding loopPractice Apple coding questions

Visible Outline of Stacked WidgetsFree to read

Home screen widgets are drawn as rectangles standing on a common baseline. Each widget is [left, right, height]. Return the key points of the combined top outline as [x, height] pairs sorted by x, where each point marks a height change and the last point drops to 0.

Input: widgets = [[2,9,10],[3,7,15],[5,12,12],[15,20,10],[19,24,8]] Output: [[2,10],[3,15],[7,12],[12,0],[15,10],[20,8],[24,0]]

What a strong answer covers

  • Sweep over sorted edge coordinates
  • Max-heap with lazy removal by right edge
  • Ground sentinel of height 0
  • Emit only on height change
  • O(n log n) time

6 more coding questions

  1. Recover Keyboard Locale Ordering Locked
  2. Thumbnail LFU Cache Locked
  3. Longest Unique Substring Locked
  4. Minimal Edit Script Locked
  5. Run-Length Encode Locked
  6. Validate IPv4 CIDR Containment Locked

Sign up free to practice all 7

Related pages

More Apple Staff rounds

Apple coding at other levels

Other companies at this level

Company guide

Apple interview guide in Academy