Code Room
CodingEasy
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) → intExamples
in
["1.2","1.10"]out-1What 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.
Learn the concepts
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.