Skip to content

Commit a7be239

Browse files
committed
refactored to reduce anti-patterns
Signed-off-by: rajput-hemant <[email protected]>
1 parent 708dd7c commit a7be239

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Diff for: src/0101-0200/119 - Pascals Triangle II/pascals_triangle_ii.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ impl Solution {
66
// loop through the vector, starting at 1
77
for i in 1..row_index {
88
// loop through the vector, starting at i + 1 and going backwards
9-
for j in (1..i + 1).rev() {
9+
for j in (1..=i).rev() {
1010
// add the value at the current index to the value at the previous index
1111
row[j as usize] += row[(j - 1) as usize];
1212
}

Diff for: src/0401-0500/476 - Number Complement/num_complement.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
impl Solution {
22
pub fn find_complement(num: i32) -> i32 {
3-
let mut res = String::new();
3+
let mut res = String::default();
44

55
for ch in format!("{:b}", num).chars() {
66
if ch == '0' {

0 commit comments

Comments
 (0)