Compare Rider App Version Strings for Feature Rollout Gates
Last updated: November 29, 2026
Quick Overview
A feature is enabled only for app versions at or above a minimum, such as `3.214.10`. Write compare(a, b) returning -1, 0 or 1 for dotted numeric versions, treating missing trailing parts as zero.
Uber
November 29, 20260
0
0 solved
A feature is enabled only for app versions at or above a minimum, such as `3.214.10`. Write compare(a, b) returning -1, 0 or 1 for dotted numeric versions, treating missing trailing parts as zero.
An Uber online assessment item that mirrors gating features by mobile client version. Graders check numeric rather than lexical comparison and the trailing-zero rule.
What the Interviewer Expects
- Splits on dots and compares parts as integers
- Pads the shorter version with zeros
- Returns at the first differing part
- Handles leading zeros like 01 equal to 1
- Writes a gate helper on top of compare
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
- Support pre-release tags like 3.2.0-beta that sort before 3.2.0.
- How would you store rollout rules per platform (iOS and Android)?
- Sort a list of versions using your comparator.
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
- Input: two strings of dot-separated non-negative integers.
- Output: -1 if a < b, 0 if equal, 1 if a > b.
1.2equals1.2.0;1.10is greater than1.9....
High-Level Design
String comparison gets 1.10 versus 1.9 wrong, so convert each part to an integer. Walk both lists in parallel up to the longer length, using 0 for missing parts. Return as soon as two parts differ...