Ad
Code
Diff
  • public class Kata {
        
        public static int speedLimit(int speed, int[] signals) {
          int penalty = 0;
          
          for (int i = 0; i < signals.length; i++){
            if (speed > signals[i]){
              if (speed - signals[i] >= 30){
                penalty += 500;
              } else if (speed - signals[i] >= 20 && speed - signals[i] < 30){
                penalty += 250;
              } else if (speed - signals[i] >= 10 && speed - signals[i] < 20){
                penalty += 100;
              }
            }
          }
          return penalty;
        }
    }
    • public class SpeedLimit{
    • public static int sequence(int[] arr) {
    • return 0;
    • }
    • public class Kata {
    • public static int speedLimit(int speed, int[] signals) {
    • int penalty = 0;
    • for (int i = 0; i < signals.length; i++){
    • if (speed > signals[i]){
    • if (speed - signals[i] >= 30){
    • penalty += 500;
    • } else if (speed - signals[i] >= 20 && speed - signals[i] < 30){
    • penalty += 250;
    • } else if (speed - signals[i] >= 10 && speed - signals[i] < 20){
    • penalty += 100;
    • }
    • }
    • }
    • return penalty;
    • }
    • }