We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
funtimeConversion(s:String):String{// Write your code here val(hour,min,seconds)=s.split(":")valisAM=seconds.subSequence(seconds.length-2,seconds.length).equals("AM")valfinalHour=if(hour.toInt()==12&&isAM){"00"}elseif(hour.toInt()==12&&!isAM){hour}elseif(hour.toInt()<12&&!isAM){"${hour.toInt() + 12}"}else{hour}return"${finalHour}:${min}:${seconds.subSequence(0,seconds.length - 2)}"}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Time Conversion
You are viewing a single comment's thread. Return to all comments →
kotlin: