Rust, O(1)
Code\n\nimpl Solution {\n    pub fn min_cost_set_time(\n        start_at: i32,\n        move_cost: i32,\n        push_cost: i32,\n        target_seconds: i32,\n
# Code\n```\nimpl Solution {\n    pub fn min_cost_set_time(\n        start_at: i32,\n        move_cost: i32,\n        push_cost: i32,\n        target_seconds: i32,\n    ) -> i32 {\n        fn cost(start_at: i32, move_cost: i32, push_cost: i32, minutes: i32, seconds: i32) -> i32 {\n            let mut number = minutes * 100 + seconds;\n            let mut cost = 0;\n            let mut current_digit = number % 10;\n            while number > 0 {\n                cost += push_cost;\n                if current_digit != number % 10 {\n                    cost += move_cost;\n                    current_digit = number % 10;\n                }\n                number /= 10;\n            }\n\n            if current_digit != start_at {\n                cost += move_cost;\n            }\n            cost\n        }\n\n        let minutes = target_seconds / 60;\n        let seconds = target_seconds % 60;                \n        \n        if minutes >= 100 {\n            return cost(start_at, move_cost, push_cost, minutes - 1, seconds + 60)\n        }\n\n        let mut best_cost = cost(start_at, move_cost, push_cost, minutes, seconds);\n        if minutes > 0 && seconds <= 39 {\n            cost(start_at, move_cost, push_cost, minutes - 1, seconds + 60).min(best_cost)\n        } else {\n            best_cost\n        }\n    }\n}\n\n```
['Rust']