LeetCode 126: Word Ladder II I'm posting my code for a LeetCode problem copied here. If you would like to review, please do so. Thank you for your time!
Problem

Given two words (begin and end), and a dictionary's word list,
find all shortest transformation sequence(s) from begin to end,
such that:
Only one letter can be changed at a time.
Each transformed word must exist in the word list. Note that begin
is not a transformed word. Note:

Return an empty list if there is no such transformation sequence.
All words have the same length.
All words contain only lowercase alphabetic characters.
You may assume no duplicates in the word list.
You may assume begin and end are non-empty and are not the same.


Inputs
&quot;hit&quot;
&quot;cog&quot;
[&quot;hot&quot;,&quot;dot&quot;,&quot;dog&quot;,&quot;lot&quot;,&quot;log&quot;,&quot;cog&quot;]
&quot;hit&quot;
&quot;cog&quot;
[&quot;hot&quot;,&quot;dot&quot;,&quot;dog&quot;,&quot;lot&quot;,&quot;log&quot;]

Outputs
[[&quot;hit&quot;,&quot;hot&quot;,&quot;dot&quot;,&quot;dog&quot;,&quot;cog&quot;],[&quot;hit&quot;,&quot;hot&quot;,&quot;lot&quot;,&quot;log&quot;,&quot;cog&quot;]]
[]

Code
#include &lt;vector&gt;
#include &lt;string&gt;
#include &lt;unordered_set&gt;
#include &lt;unordered_map&gt;
#include &lt;algorithm&gt;

struct Solution {
    const inline std::vector&lt;std::vector&lt;std::string&gt;&gt; findLadders(
                const std::string begin,
                const std::string end,
                const std::vector&lt;std::string&gt; &amp;words
    ) {
        std::unordered_set&lt;std::string&gt; dict_words(words.begin(), words.end());

        if (dict_words.find(end) == dict_words.end()) {
            return {};
        }

        graph graph;
        std::vector&lt;std::vector&lt;std::string&gt;&gt; paths;
        std::vector&lt;std::string&gt; path = {begin};

        if (make_graph(graph, begin, end, dict_words)) {
            find_paths(graph, begin, end, path, paths);
        }

        return paths;
    }

private:

    typedef unordered_map&lt;std::string, std::vector&lt;std::string&gt;&gt; graph;

    const inline bool make_graph(
        graph &amp;graph,
        const std::string begin,
        const std::string end,
        std::unordered_set&lt;std::string&gt; &amp;dict_words
    ) {
        std::unordered_set&lt;std::string&gt; candidate_words;
        candidate_words.insert(begin);

        while (!candidate_words.empty()) {
            if (candidate_words.find(end) != candidate_words.end()) {
                return true;
            }

            for (std::string word : candidate_words) {
                dict_words.erase(word);
            }

            std::unordered_set&lt;std::string&gt; curr_word;

            for (std::string word : candidate_words) {
                std::string parent = word;

                for (int chari = 0; chari &lt; word.size(); chari++) {
                    char character = word[chari];

                    for (int letter = 0; letter &lt; 26; letter++) {
                        word[chari] = 'a' + letter;

                        if (dict_words.find(word) != dict_words.end()) {
                            curr_word.insert(word);
                            graph[parent].push_back(word);
                        }
                    }

                    word[chari] = character;
                }
            }

            std::swap(candidate_words, curr_word);
        }

        return false;
    }

    static const inline void find_paths(
        graph &amp;graph,
        const std::string begin,
        const std::string end,
        std::vector&lt;std::string&gt; &amp;path,
        std::vector&lt;std::vector&lt;std::string&gt;&gt; &amp;paths
    ) {
        if (begin == end) {
            paths.push_back(path);

        } else {
            for (std::string child : graph[begin]) {
                path.push_back(child);
                find_paths(graph, child, end, path, paths);
                path.pop_back();
            }
        }
    }
};


References

Problem

Discuss

Solution
Direct character iteration
                for (int letter = 0; letter &lt; 26; letter++) {
                    word[chari] = 'a' + letter;

does not need to use integers. Instead,
for (char letter = 'a'; letter &lt;= 'z'; letter++) {
    word[chari] = letter;