Minimum Number of Operations to Convert Time LeetCode solution in JavaScript
1var getTime = function (time) {2var [hrs, mins] = time.split(":");3return parseInt(hrs) * 60 + parseInt(mins);4};56var convertTime = function (current, correct) {7var diff = getTime(correct) - getTime(current);8var order = [60, 15, 5, 1];9var ops = 0;10order.forEach((val) => {11ops += Math.floor(diff / val);12diff %= val;13});14return ops;15};