Interleaving String
Updated
Problem statement
Given strings s1, s2, and s3, return whether s3 can be formed by interleaving s1 and s2.
Interleaving means building s3 from every character of both strings, each used exactly once, while keeping each string's characters in their original left-to-right order. You can take any number of characters in a row (at least one) from one string before switching to the other.
Function
isInterleave(s1: String, s2: String, s3: String) → booleanExamples
Example 1
s1 = "aabcc"s2 = "dbbca"s3 = "aadbbcbcac"return = trueTake "aa" from s1, "dbbc" from s2, "bc" from s1, "a" from s2, and "c" from s1. That spells s3 in order, so the answer is true.
Example 2
s1 = "aabcc"s2 = "dbbca"s3 = "aadbbbaccc"return = falseThe opening "aa" must come from s1 and the "d" from s2, so the three "b"s use the next "b" of s1 and both of s2. Now both strings offer "c" but s3 needs "a", so the answer is false.
Example 3
s1 = ""s2 = ""s3 = ""return = trueAll three strings are empty, so s3 is trivially an interleaving and the answer is true.
Constraints
0 <= s1.length, s2.length <= 100.0 <= s3.length <= 200.- All three strings contain only lowercase English letters.
More Bloomberg LP Phone Screen questions
- N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
- Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
- Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
- Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Sparse Vector and Matrix OperationsPHONE SCREEN · Seen Oct 2026
- Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
Similar questions at other companies
- Longest Palindromic SubstringSiemens · PHONE SCREEN
- Query Words Within K PositionsPalantir · PHONE SCREENPalantir interview questions
- Edit DistanceDP World · PHONE SCREEN
- Longest Palindromic SubstringIBM · PHONE SCREENIBM interview questions
- Word BreakAmazon · PHONE SCREEN · ONSITE INTERVIEW
- Decode WaysThe D.E. Shaw Group · PHONE SCREENThe D.E. Shaw Group interview questions
- Edit DistanceAstrotalk · PHONE SCREEN
- Longest Palindromic SubstringeBay · PHONE SCREENeBay interview questions
- Validate a Palindrome After Limited DeletionsMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
- Count Palindromic SubstringsThe Voleon Group · PHONE SCREEN
Bloomberg LP interview experiences
- Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
- Bloomberg SWE Intern Interview Questions: 68 Questions
- Bloomberg Interview Questions, Level Not Reported: 65 Questions
- Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
- Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
- Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)