Minimum Number of Operations to Convert Time

给两个string, 里面是二十四制的小时,求最小的步骤通过1、5、10、60把string current 变成 correct。

先变成数字, 然后贪婪从大到小。

class Solution {
    public int convertTime(String current, String correct) {
        String[] strs = current.split(":");
        String[] ss = correct.split(":");
        int curSum = Integer.valueOf(strs[0])*60 + Integer.valueOf(strs[1]);
        int corSum = Integer.valueOf(ss[0])*60 + Integer.valueOf(ss[1]);
        int diff = corSum - curSum;
        int res = 0;
        res += (diff / 60);
        diff = diff % 60;
        res += (diff / 15);
        diff = diff % 15;
        res += (diff / 5);
        diff = diff % 5;
        res += diff;
        return res;
    }
}