← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Capital One’s online assessment asks you to build a Moon Phase Calculator. You are given an integer initialPhase (0-7) representing the moon’s phase on Day 1 and an integer d (1 ≤ d ≤ 10^9) representing the number of days that have passed since Day 1. The eight named phases repeat every 8 days in the order: 0 New Moon, 1 Waxing Crescent, 2 First Quarter, 3 Waxing Gibbous, 4 Full Moon, 5 Waning Gibbous, 6 Last Quarter, 7 Waning Crescent. Your task is to return the name of the phase on Day d.