FastPrepWelsh Custom Alphabet Sort
Problems/Welsh Custom Alphabet Sort

Welsh Custom Alphabet Sort

Bloomberg LP logoBloomberg LP● MediumNEW GRADFULLTIMEPHONE SCREENONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported across multiple first-hand Bloomberg graduate phone interviews. The fixed Welsh alphabet and sample are preserved from the linked source image.

Sort words using this Welsh alphabet of tokens:

a, b, c, ch, d, dd, e, f, ff, g, ng, h, i, l, ll, m, n, o, p, ph, r, rh, s, t, th, u, w, y

The tokens ch, dd, ff, ng, ll, ph, rh, and th are single alphabet symbols. Tokenize each word greedily using these two-letter symbols before single letters, then compare token ranks from left to right. If one token sequence is a prefix of another, the shorter word comes first.

Function

sortWelshWords(words: String[]) → String[]

Examples

Example 1

words = ["ddr","nah","dea","dd","ngah"]return = ["dea","dd","ddr","ngah","nah"]

d precedes dd; dd is a prefix of ddr; and ng precedes n in the supplied token alphabet.

Example 2

words = ["ca","cha","da","dda"]return = ["ca","cha","da","dda"]

The leading tokens follow c < ch < d < dd.

Constraints

  • 1 <= words.length <= 10^5.
  • Every word is nonempty, lowercase, and can be tokenized by the alphabet above.
  • The total number of characters is at most 2 * 10^5.

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

  • In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
  • Merge Weekday and Time IntervalsNextdoor · PHONE SCREENNextdoor interview questions
  • Top K Movies by Play Count from CSV DataTubi · PHONE SCREEN
  • Longest Consecutive Login StreakAmazon · ONSITE INTERVIEW
  • Group AnagramsWorkday · PHONE SCREEN
  • Find All Paths for a Name in a File SystemThe Walt Disney Company · PHONE SCREENThe Walt Disney Company interview questions
  • Keyboard Autocomplete SuggestionsLyft · ONSITE INTERVIEWLyft interview questions
  • Query JSON Records with WHERE and ORDER BYGitHub · ONSITE INTERVIEW
  • Bank Account Balances (Part 2): Monthly ReconciliationStripe · PHONE SCREENStripe interview questions
  • Sort by Odd-Position Digit SumPelatro · ONSITE INTERVIEW

Interview reports that mention this question

  • Bloomberg SWE Intern Interview Questions: 68 Questions
  • Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
  • Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)

Bloomberg LP interview experiences

  • Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
  • Bloomberg Interview Questions, Level Not Reported: 65 Questions
  • Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public String[] sortWelshWords(String[] words) {
      // Write your code here.
    }
}
Checking account…