← UiPath Interview Insights

UiPath·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Coding round at UiPath for a software engineer position. The problem was a classic number conversion question, nothing too wild, but it's the kind of thing that trips you up if you haven't thought about the subtractive cases recently.

Questions Asked (1)

Q1

Given an integer in the range 1 to 3999, convert it to its Roman numeral representation, accounting for subtractive notation like IV, IX, XL, and so on.

Algorithms & Data Structures
Author's notes

I knew the symbols but blanked on how to cleanly handle the subtractive pairs.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use a greedy algorithm with a value-symbol table that includes subtractive pairs (e.g., 900=CM, 400=CD, 90=XC, 40=XL, 9=IX, 4=IV). Iterate from largest to smallest, subtracting the value and appending the symbol while the remaining number is greater than or equal to the value.

Pro tip: Mention that the greedy approach works because the Roman numeral system is canonical for 1–3999, and note that the input range guarantee simplifies handling of large numbers and invalid inputs.

1. Clarify constraints and edge cases

Confirm the input range (1–3999) and discuss behavior for invalid inputs (e.g., 0 or >3999). Mention that the range ensures no symbols beyond M are needed.

2. Define the value-symbol mapping

Create a list of pairs in descending order, including standard symbols (1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1) with their Roman representations.

3. Implement the greedy algorithm

Iterate through the mapping, and while the number is >= the current value, append the symbol and subtract the value. This naturally handles subtractive notation.

4. Analyze complexity and test

State that time complexity is O(1) because the number of symbols is bounded (max 15 iterations). Test with edge cases like 4, 9, 40, 90, 400, 900, and 3999.

Key Points to Mention

  • Greedy algorithm with descending values
  • Inclusion of subtractive pairs (IV, IX, XL, XC, CD, CM)
  • Time complexity O(1) due to fixed number of symbols
  • Space complexity O(1) for the mapping and output string
  • Handling of edge cases like 4, 9, 40, 90, 400, 900, and 3999
  • Input validation for numbers outside 1–3999

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.