7 kyu
Simple Fun #48: Higher Version
273 of 358myjinxin2015
Description:
Task
Given two version strings composed of several non-negative decimal fields separated by periods ("."
), both strings contain equal number of numeric fields.
Return true
if the first version is higher than the second version and false
otherwise.
The syntax follows the regular semver ordering rules:
1.0.5 < 1.1.0 < 1.1.5 < 1.1.10 < 1.2.0 < 1.2.2
< 1.2.10 < 1.10.2 < 2.0.0 < 10.0.0
There are no leading zeros in any of the numeric fields, i.e. you do not have to handle inputs like 100.020.003
(it would instead be given as 100.20.3).
Example
For ver1 = "1.2.2
" and ver2 = "1.2.0"
, the output should be true;
For ver1 = "1.0.5"
and ver2 = "1.1.0"
, the output should be false.
Input/Output
[input]
stringver1
[input]
stringver2
[output]
a boolean value
Puzzles
Similar Kata:
Stats:
Created | Jan 25, 2017 |
Published | Jan 25, 2017 |
Warriors Trained | 549 |
Total Skips | 6 |
Total Code Submissions | 1515 |
Total Times Completed | 358 |
JavaScript Completions | 273 |
C# Completions | 90 |
Total Stars | 4 |
% of votes with a positive feedback rating | 94% of 114 |
Total "Very Satisfied" Votes | 101 |
Total "Somewhat Satisfied" Votes | 12 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 6 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 7 kyu |