Smallest Periodic Number At Least As Large

Asked at Amazon · Coding Questions · Difficulty: Medium

A string of digits is *attractive* if it has period `k`, i.e. `b[i] == b[i+k]` for every valid `i`. Given `old_code` (a digit string) and `k`, return the smallest attractive digit string of the **same length** that is `>= old_code`.

Loading the problem…