• + 0 comments

    Typescript:

    let result: number[] = [];
    
    for (let i of grades) {
       if (i < 38) {
          result.push(i);
       } else {
          if ((i + 2) % 5 == 0) {
                result.push(i + 2);
          } else if ((i + 1) % 5 == 0) {
                result.push(i + 1);
          } else {
                result.push(i);
          }
       }
    }
    
    return result;