Check Upgrade Eligibility Between Dotted Software Versions
Last updated: November 29, 2026
Quick Overview
Write a parser and comparator for dotted version strings such as 6.10, 6.5.2 and 7.0.1, then decide whether a cluster on version A can upgrade directly to version B given a table of minimum source versions required before crossing into a new major release.
Nutanix
November 29, 20260
0
0 solved
Write a parser and comparator for dotted version strings such as 6.10, 6.5.2 and 7.0.1, then decide whether a cluster on version A can upgrade directly to version B given a table of minimum source versions required before crossing into a new major release.
Life Cycle Manager computes which AOS, AHV and firmware upgrades a cluster may take, and string comparison of versions is a classic bug source (6.10 sorts before 6.9 as text). A phone screen uses this to see careful parsing, tuple comparison and clear handling of upgrade path rules.
What the Interviewer Expects
- Parses components as integers, not strings
- Treats trailing zeros as equal (6.10 equals 6.10.0)
- Rejects malformed input with a clear error
- Applies the minimum source version rule only when crossing majors
- Returns a reason alongside the yes or no
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you support pre-release tags like 7.0-rc1 that sort before 7.0?
- Given all published versions and allowed edges, how do you find the shortest upgrade path?
- A cluster has nodes on mixed versions mid-upgrade. Which version do you check against?
- How would you test this comparator thoroughly?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
parse_version(v) returns a comparable value. can_upgrade(current, target, min_source_for_major) returns (ok, reason). Rules: the target must be strictly newer; if the target is in a different ma...
High-Level Design
Convert each version to a tuple of ints and strip trailing zeros so 6.10.0 == 6.10. Python compares tuples lexicographically, which gives (6, 10) > (6, 9, 2) and (7,) > (6, 99), exactly the sema...