Breaking the Records solution in Kotlin -HackerRank

10 5 20 20 4 5 2 25 1

fun breakingRecords(scores: Array<Int>): Array<Int> {
var maxTotal = 0
var minTotal = 0
var max = 0
var min = 0

for (x in 0 until scores.size) {
val it = scores[x]
if (x != 0) {
if (it > max) {
max = it
else if (it < min) {
min = it

} else {
max = it
min = it
return listOf(maxTotal, minTotal).toTypedArray()}




Hey curious person, I am Software Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Playing with Date command in Linux

The cite HTML Tag

When Is the Right Time to Leave Your Current Position?

‘Processing is a means, not an end’

How to use file picker (InputFile) in Blazor .net 5

Challenging Times Require Strong Loan Management

Why I wouldn’t choose S3 bucket notifications again

Office politics is primate behaviour written in cursive

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Umar Syaid Himawan

Umar Syaid Himawan

Hey curious person, I am Software Developer

More from Medium

Ideas and Solutions for Advent of Code 2021 in Kotlin — Part 3/4

The difference between “implementation” and “api” in Gradle

Use AWS CodeArtifact in your project.

Using Kotlin’s Infix Notation to make syntax beautiful