#2469
Easy Algorithms Convert the temperature
Math
90.3% acceptance
Feb 25, 2026
748
369
You are given a non-negative floating point number rounded to two decimal places celsius,
that denotes the temperature in Celsius.
You should convert Celsius into Kelvin and Fahrenheit and return it as an array ans = [kelvin, fahrenheit].
Note that:
Kelvin = Celsius + 273.15
Fahrenheit = Celsius * 1.80 + 32.00
Solution
Rust
Time O(1)
Space O(n)
impl Solution {
pub fn convert_temperature(celsius: f64) -> Vec<f64> {
vec![celsius + 273.15, celsius * 1.8 + 32.0]
}
}