Sign In
You are coding as a Guest. Sign in with Google in 1 tap to save your daily streak, lock in +50 XP & boost your college rank!
Save Streak (1-Tap Google)
9:00 AM Daily Incident ReleaseMaintaining a 7-day streak grants a 2.5× Recruiter Visibility Multiplier on the Recruiter Talent Radar.
Multiplier Ladder:1d: 1.0ו3d: 1.5ו7d: 2.5× MAX
🔥Word Ladder: BFS Shortest Transform SequenceHard
SUPER HARD PROBLEM OF THE DAY+150 XP • FAANG OA TIER

High-difficulty challenge matching authentic Google, Amazon & Uber L5 online assessment conditions.

HardTrees & Graphs•Acceptance: 39.1%

Word Ladder: BFS Shortest Transform Sequence

Targeted in FAANG & Tech OA:AmazonGoogleMicrosoft
Real-World Engineering Context
Powers shortest path state machine transitions, mutation evolutionary trees in bioinformatics, and game-solving graph search engines.
A transformation sequence from word `beginWord` to word `endWord` using a dictionary `wordList` is a sequence of words `beginWord -> s1 -> s2 -> ... -> sk` such that: - Every adjacent pair of words differs by exactly one letter. - Every `si` for `1 <= i <= k` is in `wordList` (`beginWord` does not need to be in `wordList`). - `sk == endWord`. Given two words, `beginWord` and `endWord`, and a dictionary `wordList`, return the number of words in the shortest transformation sequence, or `0` if no such sequence exists.

Sample Test Cases

Input: ["hit","cog",["hot","dot","dog","lot","log","cog"]]
Expected: 5
Input: ["hit","cog",["hot","dot","dog","lot","log"]]
Expected: 0
Input: ["a","c",["a","b","c"]]
Expected: 2

Constraints

  • 1 <= beginWord.length <= 10
  • endWord.length == beginWord.length
  • 1 <= wordList.length <= 5000
  • wordList[i].length == beginWord.length
  • beginWord, endWord, and wordList[i] consist of lowercase English letters.
  • beginWord != endWord
  • All words in wordList are unique.
Verified Proof-of-Work ATS PortfolioCryptographic Verification
Export tamper-proof problem verifications to your direct ATS applications
DevScore: Unranked (0/1000)

Every verified problem solve writes authentic cryptographic proof-of-work to your profile. Attach your verified DevScore badge to ATS applications to stand out to engineering hiring teams across 4,000+ verified live tech openings (23,000+ cumulative audited) on RoleNest.

Explore 4,000+ Direct ATS Openings on RoleNest ↗Solve Challenge to Activate Ledger