← Questions
Smallest number from an increase and decrease pattern
0
I was asked this
No reports yet. Sign in to say where you were asked it.
Given a pattern of I (increase) and D (decrease) characters of length n, build the smallest number of n + 1 distinct digits from 1 to 9 whose consecutive digits follow the pattern. Push digits onto a stack and pop them all whenever you see an I or reach the end.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding
