Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
EFanZh committed Jan 3, 2024
1 parent 265a03d commit c58e6d4
Show file tree
Hide file tree
Showing 24 changed files with 24 additions and 42 deletions.
2 changes: 1 addition & 1 deletion src/problem_0004_median_of_two_sorted_arrays/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ mod tests {
];

for ((nums1, nums2), expected) in test_cases {
approx::assert_ulps_eq!(S::find_median_sorted_arrays(nums1.to_vec(), nums2.to_vec()), expected,);
approx::assert_ulps_eq!(S::find_median_sorted_arrays(nums1.to_vec(), nums2.to_vec()), expected);
}
}
}
5 changes: 1 addition & 4 deletions src/problem_0354_russian_doll_envelopes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ mod tests {
];

for (envelopes, expected) in test_cases {
assert_eq!(
S::max_envelopes(envelopes.iter().copied().map(Vec::from).collect()),
expected
);
assert_eq!(S::max_envelopes(envelopes.iter().map(Vec::from).collect()), expected);
}
}
}
2 changes: 1 addition & 1 deletion src/problem_0435_non_overlapping_intervals/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ mod tests {

for (intervals, expected) in test_cases {
assert_eq!(
S::erase_overlap_intervals(intervals.iter().copied().map(Vec::from).collect()),
S::erase_overlap_intervals(intervals.iter().map(Vec::from).collect()),
expected
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/problem_0436_find_right_interval/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mod tests {

for (intervals, expected) in test_cases {
assert_eq!(
S::find_right_interval(intervals.iter().copied().map(Vec::from).collect()),
S::find_right_interval(intervals.iter().map(Vec::from).collect()),
expected
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/problem_0447_number_of_boomerangs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mod tests {

for (points, expected) in test_cases {
assert_eq!(
S::number_of_boomerangs(points.iter().copied().map(Vec::from).collect()),
S::number_of_boomerangs(points.iter().map(Vec::from).collect()),
expected
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mod tests {

for (points, expected) in test_cases {
assert_eq!(
S::find_min_arrow_shots(points.iter().copied().map(Vec::from).collect()),
S::find_min_arrow_shots(points.iter().map(Vec::from).collect()),
expected
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/problem_0587_erect_the_fence/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ mod tests {

for (points, expected) in test_cases {
assert_eq!(
test_utilities::unstable_sorted(S::outer_trees(points.iter().copied().map(Vec::from).collect())),
test_utilities::unstable_sorted(S::outer_trees(points.iter().map(Vec::from).collect())),
expected
);
}
Expand Down
5 changes: 1 addition & 4 deletions src/problem_0598_range_addition_ii/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ mod tests {
];

for ((m, n, ops), expected) in test_cases {
assert_eq!(
S::max_count(m, n, ops.iter().copied().map(Vec::from).collect()),
expected
);
assert_eq!(S::max_count(m, n, ops.iter().map(Vec::from).collect()), expected);
}
}
}
5 changes: 1 addition & 4 deletions src/problem_0630_course_schedule_iii/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ mod tests {
];

for (courses, expected) in test_cases {
assert_eq!(
S::schedule_course(courses.iter().copied().map(Vec::from).collect()),
expected
);
assert_eq!(S::schedule_course(courses.iter().map(Vec::from).collect()), expected);
}
}
}
5 changes: 1 addition & 4 deletions src/problem_0646_maximum_length_of_pair_chain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ mod tests {
];

for (pairs, expected) in test_cases {
assert_eq!(
S::find_longest_chain(pairs.iter().copied().map(Vec::from).collect()),
expected
);
assert_eq!(S::find_longest_chain(pairs.iter().map(Vec::from).collect()), expected);
}
}
}
2 changes: 1 addition & 1 deletion src/problem_0684_redundant_connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ mod tests {

for (edges, expected) in test_cases {
assert_eq!(
S::find_redundant_connection(edges.iter().copied().map(Vec::from).collect()),
S::find_redundant_connection(edges.iter().map(Vec::from).collect()),
expected
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/problem_0685_redundant_connection_ii/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ mod tests {

for (edges, expected) in test_cases {
assert_eq!(
S::find_redundant_directed_connection(edges.iter().copied().map(Vec::from).collect()),
S::find_redundant_directed_connection(edges.iter().map(Vec::from).collect()),
expected
);
}
Expand Down
5 changes: 1 addition & 4 deletions src/problem_0699_falling_squares/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ mod tests {
];

for (positions, expected) in test_cases {
assert_eq!(
S::falling_squares(positions.iter().copied().map(Vec::from).collect()),
expected
);
assert_eq!(S::falling_squares(positions.iter().map(Vec::from).collect()), expected);
}
}
}
2 changes: 1 addition & 1 deletion src/problem_0757_set_intersection_size_at_least_two/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ mod tests {

for (intervals, expected) in test_cases {
assert_eq!(
S::intersection_size_two(intervals.iter().copied().map(Vec::from).collect()),
S::intersection_size_two(intervals.iter().map(Vec::from).collect()),
expected
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ mod tests {
];

for ((arr1, arr2, d), expected) in test_cases {
assert_eq!(S::find_the_distance_value(arr1.to_vec(), arr2.to_vec(), d), expected,);
assert_eq!(S::find_the_distance_value(arr1.to_vec(), arr2.to_vec(), d), expected);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mod tests {
];

for ((darts, r), expected) in test_cases {
assert_eq!(S::num_points(darts.iter().map(Vec::from).collect(), r), expected,);
assert_eq!(S::num_points(darts.iter().map(Vec::from).collect(), r), expected);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mod tests {
];

for ((n, connections), expected) in test_cases {
assert_eq!(S::min_reorder(n, connections.iter().map(Vec::from).collect()), expected,);
assert_eq!(S::min_reorder(n, connections.iter().map(Vec::from).collect()), expected);
}
}
}
2 changes: 1 addition & 1 deletion src/problem_1515_best_position_for_a_service_centre/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ mod tests {
];

for (positions, expected) in test_cases {
approx::assert_ulps_eq!(S::get_min_dist_sum(positions.iter().map(Vec::from).collect()), expected,);
approx::assert_ulps_eq!(S::get_min_dist_sum(positions.iter().map(Vec::from).collect()), expected);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ mod tests {

for ((n, edges), expected) in test_cases {
assert_eq!(
S::count_subgraphs_for_each_diameter(n, edges.iter().map(Vec::from).collect(),),
S::count_subgraphs_for_each_diameter(n, edges.iter().map(Vec::from).collect()),
expected,
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/problem_1641_count_sorted_vowel_strings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mod tests {
let test_cases = [(1, 5), (2, 15), (33, 66045)];

for (n, expected) in test_cases {
assert_eq!(S::count_vowel_strings(n), expected,);
assert_eq!(S::count_vowel_strings(n), expected);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mod tests {
];

for (tasks, expected) in test_cases {
assert_eq!(S::minimum_effort(tasks.iter().map(Vec::from).collect()), expected,);
assert_eq!(S::minimum_effort(tasks.iter().map(Vec::from).collect()), expected);
}
}
}
2 changes: 1 addition & 1 deletion src/problem_1668_maximum_repeating_substring/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mod tests {
];

for ((sequence, word), expected) in test_cases {
assert_eq!(S::max_repeating(sequence.to_string(), word.to_string()), expected,);
assert_eq!(S::max_repeating(sequence.to_string(), word.to_string()), expected);
}
}
}
2 changes: 1 addition & 1 deletion src/problem_1691_maximum_height_by_stacking_cuboids/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ mod tests {
];

for (cuboids, expected) in test_cases {
assert_eq!(S::max_height(cuboids.iter().map(Vec::from).collect()), expected,);
assert_eq!(S::max_height(cuboids.iter().map(Vec::from).collect()), expected);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ mod tests {
];

for &(queries, expected) in &test_cases[3..] {
assert_eq!(
S::ways_to_fill_array(queries.iter().copied().map(Vec::from).collect()),
expected,
);
assert_eq!(S::ways_to_fill_array(queries.iter().map(Vec::from).collect()), expected);
}
}
}

0 comments on commit c58e6d4

Please sign in to comment.