Skip to content

Instantly share code, notes, and snippets.

View akashnits's full-sized avatar
:octocat:

Akash akashnits

:octocat:
  • Bangalore
View GitHub Profile
@akashnits
akashnits / Word ladder II.md
Created February 8, 2026 07:16
Topics: BFS, DFS on Graph
Word ladder II
public List<List<String>> findLadders(String beginWord, String endWord, List<String> wordList) {

    Set<String> wordSet = new HashSet<>(wordList);
    if (!wordSet.contains(endWord)) return new ArrayList<>();

    /// make begin word part of word dict

wordSet.add(beginWord);