Created
May 7, 2025 14:57
-
-
Save BlueZeeKing/c7078b0f95a9863a8df4a60bbf4a7d5f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pub fn col_to_num(column_title: &str) -> i32 { | |
| column_title | |
| .chars() | |
| .rev() | |
| .map(|char| char as u8 - b'A' + 1) | |
| .enumerate() | |
| .map(|(idx, value)| 26i32.pow(idx as u32) * value as i32) | |
| .sum::<i32>() | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
LGTM!!