FastPrepRead Across Sound Tracks
Problems/Read Across Sound Tracks

Read Across Sound Tracks

Airbnb logoAirbnb● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Airbnb asked this as a new question in a second phone screen for a senior engineer. Several sound-track classes share a base class. It has a read method that copies the next n characters into a buffer and remembers its position. The task was to write a reader class over a list of tracks, where read continues across track boundaries. The example uses tracks a, bcd and ef. Reads of 2, 1 and 3 give ab, c and def.

The report did not say what happens when the data runs out, and gave no limits. We chose these rules: tracks are given as their data strings and the calls are given as read sizes. Each call returns its characters instead of filling a buffer. A read near the end returns what is left, which may be nothing. The limits are up to 100 tracks of up to 100 lowercase letters, with up to 1000 reads of size 1 to 500.

Our version is about 80% the same as the reported question.

Each sound track exposes a read(n) method that returns its next n characters of data (fewer if it has fewer left) and remembers where it stopped. For example, a track with data "abcde" returns "abc" for read(3) and then "de" for read(2).

Build a reader over a list of tracks, played back to back, whose read(n) returns the next n characters of the combined data. A read continues across track boundaries, so it may take characters from several tracks. If fewer than n characters are left, it returns all of them (possibly an empty string).

You are given the tracks' data as tracks and the sizes of consecutive read calls as reads. Return the string each call returns.

Function

readAcrossTracks(tracks: String[], reads: int[]) → String[]

Examples

Example 1

tracks = ["a","bcd","ef"]reads = [2,1,3]return = ["ab","c","def"]
  • The first read takes a from track 0 and continues into track 1 for b: "ab".
  • The second read takes c.
  • The third read takes d, then ef from track 2: "def".

Example 2

tracks = ["abc"]reads = [2,5,1]return = ["ab","c",""]
  • "ab", then only c is left, so the second read returns "c", and the third returns an empty string.

Example 3

tracks = ["","xy",""]reads = [1,1]return = ["x","y"]
  • Empty tracks contribute nothing: the reads return "x" and "y".

Constraints

  • 1 <= tracks.length <= 100
  • 0 <= tracks[i].length <= 100, and each track is lowercase English letters.
  • 1 <= reads.length <= 1000
  • 1 <= reads[j] <= 500

More Airbnb interview questions

  • Text JustificationPHONE SCREEN · Seen Nov 2026
  • Decode and Store StringsPHONE SCREEN · Seen Oct 2026
  • Print Sentences as TablePHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Detonate Bombs with Chain ReactionsPHONE SCREEN · Seen Aug 2026
  • Smallest Common RegionPHONE SCREEN · Seen Aug 2026
  • Longest Chain BookingPHONE SCREEN · Seen Aug 2026
  • Nested List Iterator with RemovePHONE SCREEN · Seen Jul 2026
  • Parse Query StringPHONE SCREEN · Seen May 2026
  • Credit Accounts with Scheduled TransfersOA · Seen Oct 2026
  • Parcel Attribute Store with TTLOA · Seen Oct 2026

Similar questions at other companies

  • Stateful Log Transform and SearchRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
  • In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
  • File Storage ServiceCresta · PHONE SCREENCresta interview questions
  • Return Every Matching DecryptionDuolingo · PHONE SCREENDuolingo interview questions
  • Multiline Text Editor with Cursor MovementDatologyAI · PHONE SCREEN
  • Reference-Counted Deduplicating File SystemCitadel · PHONE SCREENCitadel interview questions
  • Machine Message RouterOpenAI · PHONE SCREENOpenAI interview questions
  • In-Memory Filesystem NavigationUber · PHONE SCREENUber interview questions
  • Text Document HistoryNotion · PHONE SCREEN · ONSITE INTERVIEWNotion interview questions
  • String Copy and Move LifecycleSquarepoint Capital · PHONE SCREENSquarepoint Capital interview questions

Interview reports that mention this question

  • Airbnb Senior SWE Phone Screen Interview Experience: 1 Experience

Airbnb interview experiences

  • Airbnb SWE CodeSignal OA: 19 Experiences
  • Airbnb CodeSignal OA Experience — September 2026
All Airbnb interview questionsSee Airbnb hiring insights
Saved
class Solution {
    public String[] readAcrossTracks(String[] tracks, int[] reads) {
        // Write your code here.
    }
}
Checking account…