Input: C = 30, T = 90, Rate = [[0, 30, 4], [30, 60, 10], [60, 90, 5], [90, 100, 10]]
Output: 9
Explanation: Initially mobile charged C = 30 so, to reach 30 to 60 it will charge 10 unit per min which will take 3 min, then to reach 60 to 90 it will charge 5 unit per min which will take 6 min, So in total it will take 3+6=9 min.
Input: C = 70, T = 95, Rate = [[0, 30, 4], [30, 60, 10], [60, 90, 5], [90, 100, 10]]
Output: 4.5
Explanation: Initially mobile charged C = 70 so, to reach 70 to 90 it will charge 5 unit per min which will take 4 min, then to reach 90 to 95 it will charge 10 unit per min which will take 0.5 min, So in total it will take 4+0.5 = 4.5 min .
Iterate through the charging rate ranges (Rates), checking if the current charge level (C) has met the target charge level (T) to exit the loop early. If not, it verifies if C falls within a specific range, computes the needed charge and corresponding time to reach the range's end using the provided charging rate, and continuously adds up these times to calculate the overall charging duration. Ultimately, it returns the total time required for the entire charging process.