You are viewing a single comment's thread. Return to all comments →
Kotlin:
fun pickingNumbers(a: Array<Int>): Int { var max=0 a.sort() for(i in 0 until a.size){ var currentMax=0 for(j in i+1 until a.size){ val diff=Math.abs(a[i]-a[j]) if(diff<=1){ currentMax++ } } if(currentMax>max) max=currentMax } return max+1 }
Seems like cookies are disabled on this browser, please enable them to open this website
Picking Numbers
You are viewing a single comment's thread. Return to all comments →
Kotlin: