Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests (or task detalization) for bestHighJump #63

Open
ice-phoenix opened this issue Nov 12, 2017 · 0 comments
Open

Tests (or task detalization) for bestHighJump #63

ice-phoenix opened this issue Nov 12, 2017 · 0 comments
Labels
enhancement New feature or request trivial

Comments

@ice-phoenix
Copy link
Member

Original report by Inga Egorova (Bitbucket: Rye_eyes, GitHub: Suntrie).


#!kotlin

fun bestHighJump(jumps: String): Int {
    var parts=jumps.split(" ")
    var result= mutableListOf<Int>()
    try {
        for (i in 0 until parts.size) {
            if (parts[i]=="%-" || parts[i]=="%%-" || parts[i]=="-" || parts[i]=="%") continue
            else if (parts[i]=="+" ||  parts[i]=="%+" ||  parts[i]=="%%+") result.add(parts[i-1].toInt())
        }
    } catch (e: NumberFormatException) {
        return -1
    }
    return if (result.isEmpty()) -1
    else result.max()!!
}

Now it looks like a right decision according to the tests although different winning cases will be ommited.

@ice-phoenix ice-phoenix added trivial enhancement New feature or request labels Aug 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request trivial
Projects
None yet
Development

No branches or pull requests

1 participant