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! ๐
Top comments (0)