package leetcode;

/**
 * https://leetcode.com/problems/slowest-key/
 */
public class Problem1629 {
    public char slowestKey(int[] releaseTimes, String keysPressed) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem1629 prob = new Problem1629();
        System.out.println(prob.slowestKey(new int[]{9,29,49,50}, "cbcd")); // "c"
        System.out.println(prob.slowestKey(new int[]{12,23,36,46,62}, "spuda")); // "a"
    }
}

@@ -174,129 +174,214 @@
     
-// TODO%0A        return 0;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Problem1629 prob = new Problem1629(
+char answer = ' ';%0A        int max = 0;%0A        for (int i = 0; i %3C releaseTimes.length; i++) %7B%0A            if (i == 0) %7B%0A                max = releaseTimes%5Bi%5D;%0A                answer = keysPressed.charAt(i
 );%0A 
@@ -391,170 +391,328 @@
     
+ 
-System.out.println(prob.slowestKey(new int%5B%5D%7B9,29,49,50%7D, %22cbcd%22)); // %22c%22%0A        System.out.println(prob.slowestKey(new int%5B%5D%7B12,23,36,46,62%7D, %22spuda%22)); // %22a%22
+   %7D else %7B%0A                int diff = releaseTimes%5Bi%5D - releaseTimes%5Bi - 1%5D;%0A                char c = keysPressed.charAt(i);%0A                if (diff %3E max %7C%7C (diff == max && c %3E answer)) %7B%0A                    max = diff;%0A                    answer = c;%0A                %7D%0A            %7D%0A        %7D%0A        return answer;
 %0A   

Solve problem 1629