Idiomatic Rust Solution
I\'m new to Rust so I\'m sure there\'s a better way to do this, but this seems pretty idiomatic to me.\n\n- Time complexity: O(1)\n- Space complexity: O(n)\n\nr
I\'m new to Rust so I\'m sure there\'s a better way to do this, but this seems pretty idiomatic to me.\n\n- Time complexity: $$O(1)$$\n- Space complexity: $$O(n)$$\n\n```rust []\nimpl Solution {\n    pub fn number_of_rounds(login_time: String, logout_time: String) -> i32 {\n        let mut total = 0;\n\n        let [login_h, login_m] = login_time.split(\':\').collect::<Vec<&str>>().try_into().unwrap();\n        let login = login_h.parse::<i32>().unwrap() * 60 + login_m.parse::<i32>().unwrap();\n\n        let [logout_h, logout_m] = logout_time.split(\':\').collect::<Vec<&str>>().try_into().unwrap();\n        let logout = logout_h.parse::<i32>().unwrap() * 60 + logout_m.parse::<i32>().unwrap();\n\n        if (logout < login) { total += 1440 - login + logout } else { total += logout - login }\n        \n        if (login % 15 > 0) { total -= 15 - login % 15 } else if (logout % 15 > 0) { total -= logout % 15 }\n\n        total / 15\n    }\n}\n```
['Rust']