Sort by

recency

|

2193 Discussions

|

  • + 0 comments

    En python

    def breakingRecords(scores):
        max_count = 0
        min_count = 0
        max_score = scores[0]
        min_score = scores[0]
        for score in scores:
            if score>max_score:
                max_count+=1
                max_score = score
            if score<min_score:
                min_count+=1
                min_score = score
        return [max_count, min_count]
    
  • + 0 comments

    "Breaking the Records" represents a remarkable accomplishment, a bold leap beyond existing boundaries that sets new benchmarks and inspires others to strive for excellence. It also reminds us how the text style used to share such achievements can enhance their impact, making the message resonate even more and encouraging others to aim higher and redefine what’s possible.

  • + 0 comments

    Here is my c++ solution, you can watch the explanation here : https://youtu.be/vnovwmHPVXE

    vector<int> breakingRecords(vector<int> scores) {
        int lowest = scores[0], highest = scores[0], lowestCount = 0, highestCount = 0;
        for(int score: scores){
            if(score < lowest){lowestCount++; lowest = score;}
            if(score > highest){highestCount++; highest = score;}
        }
        return {highestCount, lowestCount};
    }
    
  • + 0 comments

    Java script solution

    let min = scores[0];
    let max = scores[0];
    let minRecord = 0;
    let maxRecord = 0;
    for(let i=1; i < scores.length; i++){
        if(scores[i] < min ) {
            min = scores[i];
            minRecord=minRecord+1;
        }
        if(scores[i] > max ) {
            max = scores[i];
            maxRecord=maxRecord+1;
        }
    }
    return [maxRecord,minRecord];
    
  • + 0 comments

    Python 3

    def breakingRecords(scores):
        hs = scores[0]
        ls = scores[0]
        hsb = 0
        lsb = 0
        for each in scores[1:]:
            if each>hs:
                hs = each
                hsb+=1
            elif each<ls:
                ls = each
                lsb+=1
            else: pass
        return [hsb, lsb]