Skip to content

Commit 8cd9fd1

Browse files
authored
Added solution for 2525
1 parent 6eedbe9 commit 8cd9fd1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Diff for: 02525. Categorize Box According to Criteria.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
impl Solution {
2+
// Initialize result as 'Neither'. If any dimensions or volume are greater than threshold, update result to Bulky. If mass is greater than threshold, update result based on whether it was already Bulky or not. Return the final result
3+
pub fn categorize_box(length: i32, width: i32, height: i32, mass: i32) -> String {
4+
let mut result = "Neither";
5+
if (length >= 10000) || (width >= 10000) || (height >= 10000) || ((length as i64) * (width as i64) * (height as i64) >= 1000000000) {
6+
result = "Bulky"
7+
}
8+
if mass >= 100 {
9+
if result == "Neither" {
10+
result = "Heavy";
11+
} else {
12+
result = "Both";
13+
}
14+
}
15+
return result.to_string();
16+
}
17+
}

0 commit comments

Comments
 (0)