Problem Statement


Given two version strings:



version1

version2






Each version consists of revisions separated by dots (.).

Compare the two versions.

Return:



1 → version1 > version2

-1 → version1 < version2

0 → Both are equal






Leading zeros should be ignored.







Brute Force Intuition


In an interview, you...