Code Room
CodingEasycod-g819
Subject String parsingLevel Entry–Mid~18 minCommon in Algorithms & data structures interviewsIndustries Software development, IT services

Question

Compare two dot-separated version strings a and b, where each chunk is a non-negative integer (no leading-zero significance: '1.01' equals '1.1'). Return -1 if a < b, 1 if a > b, and 0 if equal. Missing trailing chunks are treated as 0, so '1.0' equals '1'. Each version has up to a few hundred chunks.

Implement
compare_versions(a: str, b: str) → int
Examples
in["1.2","1.10"]out-1
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.