6 kyu

Compare Versions

1,747 of 3,873prksingh

Description:

Karan's company makes software that provides different features based on the version of operating system of the user.

To compare versions, Karan currently parses both version numbers as floats.

While this worked for OS versions 10.6, 10.7, 10.8 and 10.9, the operating system company just released OS version 10.10. This causes his method to fail, as 10.9 is greater than 10.10 when interpreting both as numbers, despite being a lesser version.

Help Karan by writing him a function which compares two versions, and returns whether or not the first one is greater than or equal to the second.

Specification notes:

  • Versions are provided as strings of one or more integers separated by ..
  • The version strings will never be empty.
  • The two versions are not guaranteed to have an equal amount of sub-versions, when this happens assume that all missing sub-versions are zero.
  • Two versions which differ only by trailing zero sub-versions will never be given.
Strings
Fundamentals

More By Author:

Check out these other kata created by prksingh

Stats:

CreatedJun 30, 2014
PublishedJun 30, 2014
Warriors Trained8051
Total Skips903
Total Code Submissions25805
Total Times Completed3873
JavaScript Completions1747
Ruby Completions222
Python Completions1623
Haskell Completions120
Rust Completions92
C++ Completions161
Factor Completions10
Total Stars125
% of votes with a positive feedback rating93% of 531
Total "Very Satisfied" Votes466
Total "Somewhat Satisfied" Votes53
Total "Not Satisfied" Votes12
Ad
Contributors
  • prksingh Avatar
  • jhoffner Avatar
  • xcthulhu Avatar
  • bkaes Avatar
  • GiacomoSorbi Avatar
  • Chrono79 Avatar
  • kazk Avatar
  • JohanWiltink Avatar
  • Souzooka Avatar
  • hobovsky Avatar
  • solitude Avatar
  • ejini战神 Avatar
  • MobulaKuhlii Avatar
  • akar-0 Avatar
  • Kacarott Avatar
  • tri@ Avatar
  • Atr1ka Avatar
  • KayleighWasTaken Avatar
Ad