INDAPlus21 / INDAPlus21/ogronman-task-2
Pass
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Very well done Oskar!
Note: Is not nmr_times/2 equal to (nmr_times+1)/2-1?
Your code:
let mut result: u32 = 0;
if nmr_times%2 == 0{
eprintln!("Even");
for _index in (nmr_times/2)..nmr_times{
result += numbers[_index];
}
}else{
for _index in ((nmr_times+1)/2-1)..nmr_times{
result += numbers[_index];
}
}
println!("{}", result);
Shorter version:
let mut result: u32 = 0;
for _index in (nmr_times/2)..nmr_times{
result += numbers[_index];
}
println!("{}", result);
Even shorter version:
println!("{}", numbers[nmr_times/2..].iter().sum::<u32>());
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file, test, or entry point is named; start by locating the Rust code containing the shown nmr_times loop and numbers slice. Compare the existing implementation with the shorter versions, then verify the relevant program output and tests still pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100