FastPrepDecode and Store Strings
Problems/Decode and Store Strings

Decode and Store Strings

Airbnb logoAirbnb● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The interview report describes decoding strings under given rules and storing the results, but preserves neither those rules nor the storage interface. This practice version authors a conventional flat run-length format and an ordered in-memory list with explicit bounds; it matches the reported decode-and-store capability at about 55%.

You are given a list of encoded strings, encoded. Start with an empty list. Decode each string in order and add the result to the end of the list. Return the full list.

Each encoded string is a series of tokens. A token is a positive count in decimal digits, followed by one lowercase ASCII letter. To decode a token, write its letter that many times. Then join the decoded tokens in order. For example, 3a2b decodes to aaabb.

Every input string is valid. Counts never start with a zero digit. There are no brackets, nesting, separators, escape rules or error records. An empty encoded string decodes to an empty string, and it still takes its own spot in the list. If the same encoded string appears more than once, store a result for each copy.

Function

decodeAndStore(encoded: String[]) → String[]

Examples

Example 1

encoded = ["3a2b","1z"]return = ["aaabb","z"]

The first string has two tokens. Its a token expands to aaa and its b token expands to bb, giving aaabb. The second string has one token, a single z. The list holds aaabb and then z.

Example 2

encoded = ["","2a1b","2a1b"]return = ["","aab","aab"]

The empty string decodes to an empty string and keeps the first spot. The next two strings are the same, and each decodes to aab. Both copies are stored, so the list is an empty string followed by aab twice.

Example 3

encoded = ["12x1y"]return = ["xxxxxxxxxxxxy"]

A count can have more than one digit. The first token is a two-digit count followed by x, so it expands to twelve x letters. The next token adds one y. The list holds that single decoded string.

Constraints

  • 0 <= encoded.length <= 1000.
  • Every token has a count from 1 through 1000 followed by one lowercase ASCII letter.
  • All encoded strings together have at most 100000 characters.
  • All decoded strings together have at most 10000 characters.
  • Every encoded string is either empty or made only of tokens as described above.

More Airbnb Phone Screen questions

  • Merge Event PreferencesPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Run-Length Encoding and DecodingPHONE SCREEN · Seen Nov 2026
  • Read Across Sound TracksPHONE SCREEN · Seen Nov 2026
  • Text JustificationPHONE SCREEN · Seen Nov 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

Similar questions at other companies

  • Search and Format ContactsAdyen · PHONE SCREENAdyen interview questions
  • Subtract Two Large Number StringsStackAdapt · PHONE SCREENStackAdapt interview questions
  • Portfolio Valuation, Part 1Stripe · PHONE SCREENStripe interview questions
  • Format a Signed Integer with CommasHudson River Trading · PHONE SCREENHudson River Trading interview questions
  • Fair Coin from a Biased CoinAnthropic · PHONE SCREENAnthropic interview questions
  • Run-Length DecodingApple · PHONE SCREENApple interview questions
  • Trace Pointer Rebinding and Pointee UpdatesArista Networks · PHONE SCREENArista Networks interview questions
  • Match a Variadic Function SignatureConfluent · PHONE SCREENConfluent interview questions
  • Delimiter-Parsing String Iteratoramo · PHONE SCREEN
  • SimpleRDD Word CountDatologyAI · PHONE SCREEN

Airbnb interview experiences

  • Airbnb OA · November 2026
  • Airbnb Campus and Full-Time SWE OA / Interviews: 9 Experiences
  • Airbnb Intern Phone Interviews: 21 Experiences (Part 7 of 7)
  • Airbnb Intern OA and Phone Screens: 17 Experiences (Part 6 of 7)
  • Airbnb Intern OA and Onsite Rounds: 16 Experiences (Part 5 of 7)
  • Airbnb Intern OA, Diplomacy Game: 19 Experiences (Part 4 of 7)
All Airbnb interview questionsSee Airbnb hiring insights
Saved
class Solution {
    public String[] decodeAndStore(String[] encoded) {
        // Write your code here.
    }
}
Checking account…