Package managers accept version ranges. Implement satisfies(version, spec) for versions MAJOR.MINOR.PATCH (integers) and specs made of space-separated comparators, all of which must hold:
>=1.2.3, >1.2.3, <=1.2.3, <1.2.3, =1.2.3 (or a bare 1.2.3)^1.2.3: >=1.2.3 <2.0.0; for 0.x, caret means >=0.2.3 <0.3.0 (if MAJOR is 0, the MINOR can't change)~1.2.3: >=1.2.3 <1.3.0|| separates alternatives (any may match)Unlock this and every premium problem across all tracks — plus hidden-test grading, advanced AI engineering modules and new content every week.
Start 7-day free trial