[algorithm] Leap year calculation