Sort by

recency

|

2238 Discussions

|

  • + 0 comments

    JAVA Solution

    public static List breakingRecords(List scores) { // Write your code here

        int max = scores.get(0);
        int min = scores.get(0);
        int maxCount = 0;
        int minCount = 0;
    
        for(int i = 1; i<scores.size(); i++){
    
            int currentScore = scores.get(i);
    
            if(currentScore > max){
                max = currentScore;
                maxCount++;
            }else if(min > currentScore){
    
                min = currentScore;
                minCount++;
    
            }
        }
    
        List<Integer> res = new ArrayList<>();
    
        res.add(maxCount);
        res.add(minCount);
    
        return res;
    }
    
  • + 0 comments
    def breakingRecords(scores):
        min=scores[0]
        max=scores[0]
        min_count=0
        max_count=0
        for i in scores:
            if i<min:
                min=i
                min_count+=1
            elif i>max:
                max=i
                max_count+=1
        return (max_count,min_count)
    
  • + 0 comments

    **** C# public static List BreakRecords(List scores) { List recordcounts = new List() { 0, 0 };

      int highestInd = 0;
      int lowestInd = 1;
      int lowestRecord = scores[0];
      int highestRecord = scores[0];
      foreach (int record in scores)
      {
          if (record < lowestRecord)
          {
              recordcounts[lowestInd]++;
              lowestRecord = record;
          }
          else if (record > highestRecord)
          {
              recordcounts[highestInd]++;
              highestRecord = record;
          }
      }
    
      return recordcounts;
    

    }

  • + 0 comments

    **** C

    public static List breakingRecords(List scores) {
    int highCount = 0,lowCount = 0,highestScore = scores[0],lowestScore = scores[0]; if (scores.Count == 0) return new List { 0, 0 }; foreach(int item in scores){ if(item > highestScore){ highCount ++; highestScore = item; } else if(item

       }
       return new List<int>{highCount,lowCount};
    
    }
    
  • + 0 comments

    def breakingRecords(scores): max_score=scores[0] min_score=scores[0] max_count=0 min_count=0 for score in scores[1:]: if score>max_score: max_score=score max_count+=1 elif score