InterviewLegend

Well-Ordered Numbers, Additive Numbers & Permutations

Alex Chen40 min readGuide updated
In this lesson
  • Generate every well-ordered number or password of a given length, digits or letters
  • Decide whether a digit string is additive, and list the additive numbers in a range
  • Print every distinct permutation of a string, repeated letters included
  • Write backtracking that reads cleanly as pseudocode in a box with no run button

Epic's skills assessment keeps coming back to one kind of problem. You get a rule, and you print every string that obeys it. Well-ordered numbers, where each digit is bigger than the one before, have 15 reports between 2019 and February 2026. Additive numbers have 11 over the same years. Permutations of a short string have 4, the newest from August 2026.

The February 2026 report is the clearest recent one. An intern's assessment asked for every additive number and for a k-digit password with strictly increasing digits, where the lowest for k = 3 is 123 and the highest is 789. Two more generators sit in the older reports, phone numbers with no repeated neighbours and letter combinations from a phone keypad. Each of the five problems here is framed as something like what candidates described. The wording changes from report to report, and the shape is what you can count on.

The Epic Systems angle
Trace before you submit. The assessment gives you a plain text box with no run button and no tests, and a September 2026 candidate said pseudocode was encouraged. Recursion hides its bugs in the base case. Walk length 1 and length 2 through your code by hand, then submit.

Backtracking on the Epic Systems skills assessment

Every problem below uses the same three moves. You hold a prefix. You try each piece the rule allows next, and you recurse on the longer prefix. When the prefix is complete, you keep it. What changes between problems is the rule that decides which pieces are allowed.

This matters past the assessment, too. Two final-day reports from 2026, in May and September, got a medium backtracking problem in the live coding round. A third 2026 candidate said that pair programming slot runs "same format as the OA on the same platform." Write these five until the skeleton comes out without thought, and spend your attention on the rule.

python
def generate(target_length):
results = []
def extend(prefix):
if len(prefix) == target_length: # complete: keep it and stop
results.append(prefix)
return
for piece in allowed_next(prefix): # the only part that changes
extend(prefix + piece)
extend("")
return results

Push the rule into the loop. Checking each finished string costs you every bad prefix along the way. If the loop only offers digits bigger than the last one, or digits that differ from it, every string that reaches full length is already valid and nothing needs filtering at the end.

Well-ordered numbers and passwords

With 15 reports, this is the most reported problem in Epic's bank. The February 2026 intern version called it a password: given k, find every k-digit password whose digits strictly increase. A July 2025 report asked for every well-ordered string of length K, and an April 2025 one for every number with d or fewer digits. The 2024 reports split between digits and letters.

Practise something like the digit version first. The letter version, where case is ignored for the ordering, is worked as the follow-up inside the solution.

1

Well-Ordered Numbers of Length K

MediumSignature problem
Problem
A number is well-ordered when each digit is strictly larger than the digit before it. 138 is well-ordered. 365 isn't, because 5 comes after 6, and 113 isn't either, because the two 1s are equal.

Write well_ordered(length) that returns every well-ordered number with exactly length digits, as strings in ascending order. Zero can't lead a number, so the digits come from 1 to 9.

If no number of that length exists, return an empty list.
Inputlength = 3Output["123", "124", ..., "689", "789"]

There are 84 of them. The smallest is 123 and the largest is 789.

How this uses the pattern

Pass the smallest digit the next position may use. The loop starts there, so every number it builds is increasing by construction.

Write it here, or go full screen with the problem, hints and solution beside the editor.

Well-Ordered Numbers of Length K

Loading...
Click "Run" to execute your code
The Epic Systems angle
Expect the variants. Reports ask for exactly k digits, for d or fewer digits, for everything below a maximum and for a letter password. A solution that takes the smallest allowed next digit as a parameter handles all of them with a one-line change.
Take it further
d or fewer digits. The April 2025 version wants every length up to d. Keep each prefix as you go, instead of only the full-length ones, and you get every shorter number in the same pass. Letters. The 2024 letter version allows upper or lower case, with order judged case-insensitively. The worked version follows the solution.

Additive numbers

Additive numbers have 11 reports, and the newest is the same February 2026 intern assessment, which asked to generate all of them. In 2021 and 2020 candidates got the check alone, "the isNumberAdditive question on LeetCode." A 2019 intern had to find every additive number between two bounds, with 112, 1123 and 224 as examples. Older reports also phrase it as "is this a Fibonacci sequence" and once as the longest chain that adds up.

The problem below is something like the range version, since it holds the check inside it. The 2019 wording summed single digits. Here a term can have several digits, as in LeetCode's Additive Number, and every single-digit chain still passes.

2

Additive Numbers in a Range

MediumSignature problem
Problem
A number is additive when its digits split into a sequence of at least three numbers. Each number after the first two is the sum of the two before it. 112358 is additive, as 1, 1, 2, 3, 5, 8. So is 199100199, as 1, 99, 100, 199.

A term can't have a leading zero, so 1023 can't be read as 1, 02, 3. A term that is just 0 is fine, which makes 101 additive as 1, 0, 1.

Write additive_numbers(low, high) that returns every additive number from low to high inclusive, in ascending order.
Inputlow = 100high = 200Output[101, 112, 123, 134, 145, 156, 167, 178, 189]

Three digits allow only one split, so the first two digits must add up to the third.

How this uses the pattern

The first two numbers decide everything after them. Try every way to cut those two from the front, then check that each next sum appears where it should.

Write it here, or go full screen with the problem, hints and solution beside the editor.

Additive Numbers in a Range

Loading...
Click "Run" to execute your code
The Epic Systems angle
The check is the real problem, and Epic has asked it bare and wrapped in a range. Write it as its own function. Then the range version is one loop, and the "is this string additive" version is the function itself. Say the leading-zero rule out loud, because it's the edge most people forget.
Take it further
A huge range. Testing every number is fine for a few thousand values and slow for billions. Build from the front instead. Choose the first two terms, keep adding, and end the chain once the string is longer than high. That builds only the additive numbers, so the work tracks the answer size instead of the range. Sort and drop duplicates at the end, since 11213 comes from both 1, 12, 13 and 11, 2, 13.

Every permutation of a string

An August 2026 candidate wrote that Epic "asked a question on permutations to get every order of 'abc'." An August 2025 review listed "primes and permutations" and added that the test "hasn't changed in years." A 2020 version took the string from the user, and a 2019 one asked to print every permutation of a given string.

None of those reports mention repeated letters. The version below handles them anyway, because "aab" is an obvious input to try once "abc" works.

3

Permutations of a String

MediumFrequently asked
Problem
Write string_permutations(text) that returns every ordering of the letters in text, in alphabetical order. The string has at least one letter.

If a letter repeats, each distinct ordering appears once. For "aab" that's three strings, even though there are six ways to arrange the three positions.
Inputtext = "abc"Output["abc", "acb", "bac", "bca", "cab", "cba"]

Three distinct letters give 3! = 6 orderings.

How this uses the pattern

Sort the letters and mark each one used as you place it. When a letter equals the one before it and that earlier copy isn't in use, skip it.

Write it here, or go full screen with the problem, hints and solution beside the editor.

Permutations of a String

Loading...
Click "Run" to execute your code
The Epic Systems angle
On "abc" almost any approach looks fine. Write it with a used list rather than slicing new strings on every call, because it reads cleaner as pseudocode and is easier to trace. Then say what happens with repeats before anyone asks.
Take it further
No recursion. Generate each permutation from the one before. From the right, find the first letter smaller than its neighbour, swap it with the smallest bigger letter to its right, then reverse the tail. Start from the sorted string and stop when no such letter exists. It copes with repeated letters with no extra check, and it needs only O(n) memory beyond the output.

Older problems (2017-2025)

These two have no report from the last twelve months. Both are still worth an hour, because they use the same skeleton with a different rule, and Epic's bank changes slowly.

Phone numbers with no repeated neighbours (2021-2025)

Seven reports from November 2021 to June 2025 describe a phone-number generator. A February 2024 intern got every number of length L with one to three banned digits, no equal neighbours, and a 4 only as the first digit. In July 2024 the neighbour rule came with an example (0232 is fine, 0223 isn't), and the 4 rule read differently: any number holding a 4 had to start with one. A 2023 version banned two 4s in a row instead. Practise something like the February 2024 rules.

4

Phone Numbers Under Digit Rules

MediumSometimes asked
Problem
Write phone_numbers(length, banned) that returns every phone number with exactly length digits, as strings in ascending order. Digits run from 0 to 9, and 0 may lead.

A valid number follows three rules. No digit in banned appears. No two neighbouring digits are equal, so 0232 is fine and 0223 isn't. And a 4 may only be the first digit.

If length is 0, return an empty list.
Inputlength = 3banned = [1, 2, 3, 5, 6, 7, 8]Output["090", "409", "490", "909"]

Only 0, 4 and 9 are allowed. The 4 can lead but can't appear later, and neighbours must differ.

How this uses the pattern

Same skeleton, new rule. Before you extend with a digit, check it isn't banned, isn't the last digit of the prefix, and isn't a 4 unless the prefix is empty.

Write it here, or go full screen with the problem, hints and solution beside the editor.

Phone Numbers Under Digit Rules

Loading...
Click "Run" to execute your code
The Epic Systems angle
The rules here are small and easy to misread, and there's no run button to catch the slip. Put each rule on its own line with a comment, so whoever reads it can tick them off one by one.
Take it further
Count them instead. Length 7 with nothing banned already gives 2,654,208 numbers, too many to print in an assessment. If they ask how many, count by last digit instead of listing. The worked version is below the solution.

Letter combinations of a phone number (2017-2025)

Five reports from 2017 to March 2025 ask for every string a digit sequence could spell. The March 2025 intern assessment named LeetCode's Letter Combinations of a Phone Number outright. A 2019 intern got a custom mapping, where 2 maps to w, s and x and 3 to e, d and c. The 2017 version numbered your fingers 0 to 9, with each one owning some keys. Practise something like the standard keypad first, then the custom map in the follow-up.

5

Letter Combinations of a Phone Number

MediumSometimes asked
Problem
On an old phone keypad, each digit from 2 to 9 stands for a few letters. The 2 key has abc, 3 has def, 4 has ghi and 5 has jkl. The rest are mno on 6, pqrs on 7, tuv on 8 and wxyz on 9.

Write letter_combinations(digits) that returns every string the digits could spell, one letter per digit. List them with the first digit's letters varying slowest, in keypad order.

The input only holds digits 2 to 9. An empty input returns an empty list.
Inputdigits = "23"Output["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"]

Three letters for 2 times three for 3 gives nine strings.

How this uses the pattern

Recurse on the position in the digit string. At each position, loop over that digit's letters and extend the prefix with each one.

Write it here, or go full screen with the problem, hints and solution beside the editor.

Letter Combinations of a Phone Number

Loading...
Click "Run" to execute your code
The Epic Systems angle
The older Epic versions hand you the mapping instead of the keypad. Keep the map in one dictionary at the top so the custom version is a change to that line. And handle the empty input before the recursion, or it returns one empty string.
Take it further
Your own map. The 2019 and 2017 versions told you which keys each digit or finger owns. Take the map as a parameter and nothing else changes. The worked version is below the solution.

Writing it with no run button

Candidates in 2025 and 2026 describe the same box. You can't compile, there are no tests, and you submit what you typed. "You could not run the code you write," an October 2026 candidate wrote. That changes how you should practise these five. Type each one into a plain text file, read it back once, and trace the smallest inputs by hand before you look at the answer.

Do

  • Put the base case first and keep it to two lines
  • Name the rule in a comment on the line that applies it
  • Trace length 1, length 2 and the empty input by hand
  • Use plain loops and lists that read as pseudocode in any language

Don't

  • Reach for itertools.permutations when the task is to write the permutations yourself
  • Generate everything and filter at the end when the rule fits in the loop
  • Forget to undo the used mark after the recursive call
  • Submit without walking one example through the recursion

Common questions

What coding questions are on the Epic Systems skills assessment?

Backtracking generators lead. Well-ordered numbers and additive numbers both turned up on a February 2026 intern assessment, and permutations of "abc" in August 2026. Grid problems like word search and Mingo come next, then string problems like adjacent swaps and keypad encoding. The coding section usually has four problems, easy to medium.

Are the Epic Systems coding questions on LeetCode?

Some are close. Additive numbers is LeetCode 306, letter combinations is 17, and permutations is 46, or 47 once letters repeat. Well-ordered numbers sits near Sequential Digits and Combinations without matching either. The phone-number generator has no LeetCode twin, so practise it from the statement above.

Can I write pseudocode on the Epic coding assessment?

Several 2025 and 2026 reports say yes, and a September 2026 review called it "encouraged." Clear code still beats vague pseudocode. Write real loops and real conditions in whichever language you choose, so a reader can follow each step.

Do these come up at the final interview too?

The final interview has one pair programming problem in a slot of about 45 minutes. Two 2026 reports, from May and September, describe it as a medium backtracking problem. Another 2026 candidate got a LeetCode easy. Working these five covers the backtracking shape.

Key Takeaways

  • ✓Generate-everything backtracking is the most reported Epic coding shape, led by well-ordered and additive numbers in February 2026.
  • ✓Put the rule inside the loop. Then every string that reaches full length is valid and needs no filtering.
  • ✓For additive numbers, the first two terms decide everything. Try each cut, and reject terms with leading zeros.
  • ✓With no run button, trace length 1, length 2 and the empty input by hand before you submit.
Epic Systems interview guide

Know what Epic Systems asks before you walk in.

28 coding · 4 system design · 20 behavioral questions

Get Premium$49 a year · Instant access
Or start freeNo card.

Get their questions first.

The Epic Systems Skills AssessmentHad your Epic Systems interview?How we research

InterviewLegend is independent and not affiliated with or endorsed by any company it covers.