![]() |
VOOZH | about |
Given a positive integer W which represents the number of weeks, your task is to convert it to the total number of hours.
Examples:
Input: W=15
Output: 2520Input: W=1
Output: 168
Approach: To solve the problem, follow the below idea:
The problem can be solved using simple mathematical conversions:
- 1 Week = 7 days
- 1 Day = 24 hours
Step-by-step algorithm:
Below is the implementation of the algorithm:
2520 168
Time Complexity: O(1)
Auxiliary Space: O(1)