Epic Interview Question: Write a function which, given... | Glassdoor

Interview Question

Software Developer Interview Madison, WI

Write a function which, given n, prints all well-ordered

  integers of n digits. A well ordered number is one where the value of the i-th digit is less than the value of the i+1 digit.
technical, programming

Interview Answer

5 Answers


What does it mean by "all well-ordered integers"? For example, if n=3, then should "all well-ordered integers" look like this:
1, 2, 3, 12, 13, 23, 123?

Anonymous on Oct 30, 2009

@anonymous: it means print all integers of 'n' digits, where the digits are in ascending order:
for n=3: 123, 234, 345 ...789

dopey on Jun 6, 2011

Are you sure? There is no upper bound then. What is your upper bound? How do you determine the upper bound? I believe you misunderstood the question.

Anonymous on Oct 26, 2012

123, 124, 125 ... 129, 134, 135 ...139 ...234 ... 289 ...789

eric on Jan 14, 2015

The upper bound is the n digit not with all 9s

Anonymous on Mar 30, 2018

Add Answers or Comments

To comment on this, Sign In or Sign Up.