01 · CoreFirsthand candidate report
Find the missing seconds
Given an array representing observed seconds, find the seconds that are missing.
A July 2025 Apple ML Engineer candidate listed this as one of four coding questions in the screening round. The post does not disclose the exact input schema, range, or duplicate policy—clarify those before coding.
Practice focus
- State assumptions about the time range and ordering
- Compare set, sorting, and linear-scan approaches
- Cover duplicates, empty input, and boundary seconds
Evidence and sources
Role: ML Engineer · Date: Jul 2025
Named directly in a candidate’s Apple screening recap.
02 · CoreFirsthand candidate report
Longest consecutive sequence
Return the length of the longest run of consecutive integers in an unsorted array.
The same July 2025 Apple ML Engineer candidate reported this alongside the missing-seconds problem. No additional constraints were published.
Practice focus
- Reach expected O(n) time with a hash set
- Only begin scanning at sequence starts
- Explain behavior with duplicates and negative values
Evidence and sources
Role: ML Engineer · Date: Jul 2025
Named directly in a candidate’s Apple screening recap.
03 · StretchFirsthand candidate report
Linear regression from scratch
Implement linear regression from scratch, then discuss the computational problem with directly using a matrix inverse.
An Apple interview participant described this exact task in the July 2025 ML Engineer thread. The follow-up explicitly focused on the matrix-inverse bottleneck.
Practice focus
- Implement fit and predict without a modeling library
- Explain inverse cost and numerical instability
- Offer solve, pseudo-inverse, or gradient descent alternatives
Evidence and sources
Role: ML / ML-adjacent Engineer · Date: Jul 2025
Reported by an interview participant in the discussion.
04 · CoreFirsthand candidate report
Cumulative sum in Python
Implement a cumulative sum in Python—the candidate was asked to solve the same operation in both Python and SQL.
A candidate for Apple’s AI & Data Platforms organization reported a 45-minute first round split between SQL and Python, with cumulative sum asked in both.
Practice focus
- Write the simple one-pass implementation
- Discuss iterator and streaming variants
- Handle empty input and numeric types
Evidence and sources
Role: Software Engineer, Data Solutions · Date: 2025 report · Apr 2026 follow-up
The candidate explicitly names cumulative sum in both languages.
05 · StretchCandidate interview database
Return every subset matching a target
Given a collection of values and a target, return all subsets whose sum equals the target.
A Glassdoor Apple ML Engineer entry dated July 13, 2026 reports: solve subset sum and return all matching subsets. The listing does not expose the candidate’s full constraints.
Practice focus
- Clarify whether values or subsets may repeat
- Give a correct backtracking solution first
- Discuss pruning, negative values, and output-sensitive cost
Evidence and sources
Role: Machine Learning Engineer · Date: Jul 2026
Candidate-submitted Apple ML Engineer question, dated July 2026.
06 · StretchTwo candidate database reports
Masked multi-head self-attention
Implement masked multi-head self-attention for a Transformer from scratch.
Glassdoor lists this for an Apple ML Engineer interview on July 7, 2026. A separate Apple Cambridge AIML candidate also reported being asked to code attention in PyTorch.
Practice focus
- Track batch, head, sequence, and feature dimensions
- Scale logits and apply the mask before softmax
- Explain causal versus padding masks and stability
Evidence and sources
Role: Machine Learning Engineer / AIML · Date: Jul 2026 · Sep 2024
Two Apple reports converge on implementing attention.
07 · StretchCandidate interview database
Vertical-order tree traversal
Traverse a binary tree vertically and return nodes in column order.
Glassdoor lists vertical-order traversal, including column ordering, for an Apple ML Engineer interview dated July 7, 2026.
Practice focus
- Clarify tie-breaking for nodes sharing row and column
- Use BFS with horizontal distance
- Separate traversal complexity from output sorting
Evidence and sources
Role: Machine Learning Engineer · Date: Jul 2026
Candidate-submitted Apple ML Engineer question, dated July 2026.
08 · StretchFirsthand candidate report
K-means, one method per step
Implement k-means from scratch, structuring the solution as a method for each algorithmic step.
A 1Point3Acres Apple Data Scientist / ML Scientist technical-screen report says the interviewer asked for k-means and specifically wanted a method written for every step.
Practice focus
- Separate initialize, assign, update, and convergence
- Vectorize distance computation
- Handle empty clusters and reproducible initialization
Evidence and sources
Role: Data Scientist / ML Scientist · Date: 2020
Exact implementation topic and requested structure are visible in the report.
09 · CoreOriginal report + detailed repost
Move zeros to the end
Move every zero to the end while preserving the relative order of nonzero values.
[1, 2, 0, 4, -1, 5, 6, 0, 0, 7, 0]
→ [1, 2, 4, -1, 5, 6, 7, 0, 0, 0, 0]
An Apple Cloud Data Engineer interview recap publishes the example below. A detailed repost and a solution article both link back to the original account.
Practice focus
- Preserve nonzero ordering
- Compare allocation and in-place approaches
- State time and space complexity
Evidence and sources
Role: Cloud Data Engineer · Date: 2023
The published example fixes the intended stable ordering.
10 · CoreOriginal report + detailed repost
Run-length encode a string
Compress consecutive character runs by appending each character and its run count.
abcabbbccaabd
→ a1b1c1a1b3c2a2b1d1
The Apple Cloud Data Engineer account includes the exact sample below. This is run-length encoding of consecutive runs, not a total frequency count.
Practice focus
- Scan once and flush the current run
- Cover empty and single-character strings
- Avoid quadratic repeated string concatenation
Evidence and sources
Role: Cloud Data Engineer · Date: 2023
An exact input/output pair is published in the interview recap.
11 · StretchFirsthand candidate report
Longest prefix with the least frequency
Find the longest prefix with the least frequency.
A June 2026 Apple Search AIML candidate reports this as the second technical round, implemented with a trie. The interviewer followed up on space complexity. The source does not define “frequency” or the input format, so those are required clarifications.
Practice focus
- Clarify what is counted and how ties are broken
- Explain when a trie is preferable to a prefix hash map
- Derive time and space cost from alphabet and total characters
Evidence and sources
Role: Search AIML · Date: Jun 2026
The task, trie choice, and space-complexity follow-up are explicit; the missing input contract remains missing.
12 · StretchOriginal report + detailed repost
Build a PySpark cloud pipeline
Write PySpark that mounts cloud storage, applies transformations, and writes the result to a date-partitioned folder with a timestamped filename.
This end-to-end coding task appears in a detailed recap of an Apple Cloud Data Engineer interview. The public summary preserves the required stages but not the exact transformation list.
Practice focus
- Separate read, transform, partition, and write stages
- Make timestamping deterministic and timezone-aware
- Discuss idempotency, small files, and reruns
Evidence and sources
Role: Cloud Data Engineer · Date: 2023
The pipeline steps are enumerated in the recap of the original account.
13 · CoreFirsthand candidate report
Recursively collect a directory tree
Starting from a parent directory, recursively add its directories, subdirectories, and files to a list.
A December 2024 Apple Data Engineer candidate reported this Python task. The post does not publish the desired path format, traversal order, or symlink behavior.
Practice focus
- Clarify traversal order and path representation
- Prevent symlink cycles and handle permission failures
- Compare recursive lists with lazy generators
Evidence and sources
Role: Data Engineer · Date: Dec 2024
Named directly in the candidate’s technical-round recap.
14 · CoreFirsthand candidate report
Reverse characters, keep digits fixed
Reverse the non-digit characters in an input string while leaving every digit in its original position.
A 1Point3Acres Apple Data Scientist phone-screen report gives this rule directly. The public portion does not show an example input/output.
Practice focus
- Preserve digit indices exactly
- Use a two-pointer scan or extracted character stack
- Clarify Unicode and sign/punctuation treatment
Evidence and sources
Role: Data Scientist · Date: 2020
The transformation rule is visible in the original interview report.
15 · StretchCandidate interview database
Custom forward and backward pass
Implement the forward and backward passes of a custom function for backpropagation.
A July 2025 Apple Machine Learning Engineer entry on Glassdoor lists this as an interview task. The public listing does not identify the custom function.
Practice focus
- Cache only tensors needed by backward
- Derive gradients and respect broadcasting
- Validate with finite differences or gradcheck
Evidence and sources
Role: Machine Learning Engineer · Date: Jul 2025
The exact function is omitted, so practice the interface and gradient reasoning.
16 · StretchCandidate interview database
Fix slow Python code
Inspect a deliberately slow code sample and rewrite it to run efficiently.
A July 2025 Apple Machine Learning Engineer entry on Glassdoor states: “This code is very slow. Fix it.” The snippet itself is not publicly visible.
Practice focus
- Measure before optimizing and identify the hot path
- Spot accidental quadratic work and repeated allocation
- Explain when vectorization, batching, or caching helps
Evidence and sources
Role: Machine Learning Engineer · Date: Jul 2025
The performance directive is exact; the underlying snippet is not exposed.
17 · CoreFirsthand candidate report
Root-to-leaf target sum
Determine whether a binary tree has a root-to-leaf path whose values sum to a target.
An interview participant in the July 2025 Apple ML Engineer discussion reported receiving this task. The comment does not publish extra constraints.
Practice focus
- Respect the root-to-leaf requirement
- Give recursive and iterative variants
- Cover negative values and a missing root
Evidence and sources
Role: ML / ML-adjacent Engineer · Date: Jul 2025
Reported by an Apple interview participant in the discussion.
18 · CoreFirsthand candidate report
Merge overlapping intervals
Merge all overlapping intervals and return the resulting non-overlapping ranges.
An interview participant in the July 2025 Apple ML Engineer discussion reported this task in the same round as root-to-leaf target sum.
Practice focus
- Clarify whether touching intervals merge
- Sort once and scan linearly
- Avoid mutating caller-owned interval objects
Evidence and sources
Role: ML / ML-adjacent Engineer · Date: Jul 2025
Reported by an Apple interview participant in the discussion.
19 · StretchFirsthand commenter report
Simplified Naive Bayes and association rules
Implement a simpler version of Naive Bayes and association-rule mining.
A commenter describing their own Apple MLE interview says the coding round asked for simpler implementations of Naive Bayes and Association Rules. The source does not publish datasets, APIs, or exact variants.
Practice focus
- Build fit and predict around counts and log probabilities
- State smoothing and unseen-category behavior
- Implement support and confidence without a mining library
Evidence and sources
Role: Machine Learning Engineer · Date: May 2022
The commenter states they received both implementation tasks; no hidden constraints are reconstructed.
20 · StretchFirsthand candidate report
Clean a corpus and predict probable next words
Clean a text corpus, then implement logic that predicts probable next words.
A successful 2025 Apple MLE candidate reports this as the NLP focus of technical round three. The public account does not state whether the expected model was n-gram-based or learned.
Practice focus
- Define tokenization and normalization before implementation
- Offer a transparent bigram or n-gram baseline
- Handle unseen contexts, ties, and deterministic output
Evidence and sources
Role: Machine Learning Engineer · Date: Aug 2025
Corpus cleaning and next-word prediction are explicit; the algorithm and evaluation contract are not.