INDAPlus21 / INDAPlus21/eliasfl-task-2
Pass
- Dominant language
- Rust
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
**Very well done Elias!**
Förslag:
_Your code_:
```rust
let distance = min(vertical_dist, horizontal_dist);
let distance = distance.to_string();
print!(
"{}",
// Print '.' if string of distance has more than one character
if distance.chars().count() > 1 {
String::from(".")
} else {
distance
}
);
```
_Suggestion_:
```rust
print!("{}",
if min(vertical_dist, horizontal_dist) < 10 {
std::char::from_digit(_min, 10).unwrap()
} else {
'.'
}
);
```
And, no need to error check Kattis inputs.
Contributor guide
No contributing guide indexed for this repository
Research direction
Review the Rust distance-printing snippet in the issue and compare the current approach with the suggested conditional output. Confirm the expected output for distances below and above 10, then update the relevant implementation if the suggestion is still wanted. No file path or test is mentioned, so verify the result using the assignment's available input checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100