https://github.com/aliezzahn/word-ladder
find the shortest transformation sequence from the begin_word to the end_word using words from the word_list. Each transformation must change exactly one letter at a time, and each intermediate word must exist in the word_list.
https://github.com/aliezzahn/word-ladder
Last synced: 3 months ago
JSON representation
find the shortest transformation sequence from the begin_word to the end_word using words from the word_list. Each transformation must change exactly one letter at a time, and each intermediate word must exist in the word_list.
- Host: GitHub
- URL: https://github.com/aliezzahn/word-ladder
- Owner: aliezzahn
- License: mit
- Created: 2025-02-24T13:44:05.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-02-24T13:51:13.000Z (3 months ago)
- Last Synced: 2025-02-24T14:42:22.357Z (3 months ago)
- Language: Rust
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Word Ladder

A Rust implementation of the Word Ladder problem.
## Problem Description
Given two words (`begin_word` and `end_word`), and a dictionary of words (`word_list`), find the length of the shortest transformation sequence from `begin_word` to `end_word` such that:
- Only one letter can be changed at a time.
- Each transformed word must exist in the `word_list`.## Usage
### Installation
Add this crate to your `Cargo.toml`:
```toml
[dependencies]
word-ladder = "0.1.0"
```### Example
```rust
use word_ladder::ladder_length;fn main() {
let begin_word = String::from("hit");
let end_word = String::from("cog");
let word_list = vec![
String::from("hot"),
String::from("dot"),
String::from("dog"),
String::from("lot"),
String::from("log"),
String::from("cog"),
];
let result = ladder_length(begin_word, end_word, word_list);
println!("Transformation steps: {}", result); // Output: 5
}
```## Running Tests
To run the tests, use the following command:
```bash
cargo test
```## Contributing
Contributions are welcome! Please open an issue or submit a pull request.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.