DEV Community

Nitin Ahirwal
Nitin Ahirwal

Posted on

LeetCode Day 8 โ€” Compare Version Numbers (165)

Day 8 of my LeetCode streak ๐Ÿš€

Todayโ€™s problem was 165. Compare Version Numbers โ€” a neat string parsing challenge where the tricky part isnโ€™t the logic itself, but handling all the little details:

  • Ignoring leading zeros ("01" = "001")
  • Treating missing revisions as 0 ("1.0" = "1.0.0")
  • Comparing uneven revision lengths

I solved it in JavaScript by splitting the version strings into arrays, comparing each part as integers, and defaulting to 0 when one version runs out of parts.

Even on a distracted day (hello, Twitter doomscrolling ๐Ÿ˜…), keeping the streak alive matters.

๐Ÿ‘‰ Full breakdown with code and reflections on my blog:
https://nitinahirwal.in/posts/165-CompareVersionNumbers

On to Day 9! ๐Ÿš€

LeetCode #JavaScript #100DaysOfCode

Top comments (0)