FastPrepWord Ladder
Problems/Word Ladder

Word Ladder

Bloomberg LP logoBloomberg LP● HardNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a firsthand Bloomberg new-grad interview as the shortest Word Ladder sequence. You return the number of words in that shortest sequence.

You are given beginWord, endWord, and a dictionary wordList. A transformation changes exactly one character, and every transformed word—including endWord—must appear in the dictionary.

Return the number of words in the shortest valid sequence from beginWord through endWord, counting both endpoints. Return 0 when no sequence exists. If the two endpoints are equal, the answer is 1 only when that word appears in the dictionary.

Function

ladderLength(beginWord: String, endWord: String, wordList: List<String>) → int

Examples

Example 1

beginWord = "hit"endWord = "cog"wordList = ["hot","dot","dog","lot","log","cog"]return = 5

One shortest sequence is hit -> hot -> dot -> dog -> cog, which contains five words.

Example 2

beginWord = "hit"endWord = "cog"wordList = ["hot","dot","dog","lot","log"]return = 0

The endpoint is absent from the dictionary, so no valid ladder exists.

Example 3

beginWord = "same"endWord = "same"wordList = ["same","came"]return = 1

The endpoints already match and the endpoint appears in the dictionary.

Constraints

  • 1 <= beginWord.length == endWord.length <= 10.
  • 1 <= wordList.length <= 5000.
  • Every dictionary word has the same length as beginWord.
  • Words contain only lowercase English letters.

More Bloomberg LP Onsite Interview questions

  • Pascal's TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Valid Triangle NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Top K Frequent WordsONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Word LadderGoogle · ONSITE INTERVIEWGoogle interview questions
  • Word LadderAmazon · ONSITE INTERVIEW
  • Find Duplicate Files in a FilesystemHarvey · PHONE SCREEN · ONSITE INTERVIEWHarvey interview questions
  • Minimum Word Ladder LengthSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Word LadderGoldman Sachs · PHONE SCREEN · ONSITE INTERVIEWGoldman Sachs interview questions
  • Word LadderMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Shortest Word Transformation SequenceReddit · PHONE SCREENReddit interview questions
  • Minimum Numeric Code TransformationAdobe · OAAdobe interview questions
  • Shortest Word Chain Between Two WordsFanatics · PHONE SCREEN
  • Linked Merchants Within Two HopsStripe · PHONE SCREENStripe interview questions

Interview reports that mention this question

  • Bloomberg Interview Questions, Level Not Reported: 65 Questions

Bloomberg LP interview experiences

  • Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
  • Bloomberg SWE Intern Interview Questions: 68 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)
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public int ladderLength(String beginWord, String endWord, List<String> wordList) {
      // write your code here
    }
}
Checking account…