Next Happy Year
Challenge Difficulty: Medium | Estimated completion time: ~15 minutes
Sloth needs your help to find out the next happy year.
A Happy Year is the year with only distinct digits (no duplicates).
Create a function that takes an integer year and returns the next happy year.
Examples
happyYear(2017)
output = 2018
# 2018 is the next happy year with all numbers being different.
happyYear(1990)
output = 2013
# 2013 is the next happy year with all numbers being different.
happyYear(2021)
output = 2031
# 2031 is the next happy year with all numbers being different.Solution
Python
Output