Skip to content

#005 Convert Age to Days

Adam Kubiś edited this page Mar 30, 2025 · 2 revisions

Published by medyah99

algebra algorithms math

Create a function that takes the age in years and returns the age in days.

CalcAge(65) ➞ 23725

CalcAge(0) ➞ 0

CalcAge(20) ➞ 7300

Notes

  • Use 365 days as the length of a year for this challenge.
  • Ignore leap years and days between last birthday and now.
  • Expect only positive integer inputs.

Complexity

O(1), function performs a simple multiplication operation—multiplying the input age (in years) by 365—which takes constant time and uses constant space..

This means that the execution time and memory usage remain the same regardless of the input size.

flowchart

Clone this wiki locally