Compare two versions
Input
Version('1.2.3') < Version('1.3.0')
Output
True
Compare major (1==1), then minor (2<3) so the first is less.
Full lesson preview
Create a Version class that compares semantic version strings using < and <=.
Problem statement
Task
Examples
Input
Version('1.2.3') < Version('1.3.0')
Output
True
Compare major (1==1), then minor (2<3) so the first is less.
Input format
Output format
Constraints
Samples
Input
Version('2.0.0') <= Version('2.0')
Output
True
'2.0' is treated as '2.0.0' so they are equal and <= returns True.