Reliability improves when failures happen less often or recovery happens faster. Mean time between failures (MTBF) and mean time to repair (MTTR) connect those two operational levers to steady-state availability.
Design a ReliabilityRecoveryPlanner class:
ReliabilityRecoveryPlanner() creates a stateless planner.double availability(double mtbfHours, double mttrHours) returns steady-state availability, rounded to 5 decimal places.double maximumMttr(double mtbfHours, double targetAvailability) returns the largest MTTR that still meets the target, rounded to 5 decimal places.boolean meetsTarget(double mtbfHours, double mttrHours, double targetAvailability) reports whether the current values meet or exceed the target.
Use these formulas:
Availability and target availability are fractions between 0 and 1, not percentages. meetsTarget must compare the unrounded availability. Each call is independent.
Example 1:
Input:
Output:
Explanation: The service is available for 720 / 721 of the cycle. To reach 0.999 availability without changing MTBF, mean repair time must fall to approximately 0.72072 hours or less.
Example 2:
Input:
Output:
Explanation: The current 0.5-hour MTTR is below the 0.87609-hour maximum for the target.
Constraints
0 < mtbfHours <= 10^90 <= mttrHours <= 10^90 < targetAvailability <= 1- MTBF and MTTR use the same time unit.
- Numeric answers are accepted within
10^-5 of the expected result. - At most
100 total method calls are made.