You are viewing a single comment's thread. Return to all comments →
Single Pass One Line def hackerlandRadioTransmitters(x: Array[Int], k: Int): Int = x.foldLeft((-1,-1,-1)) { case ((-1,-1,-1),_) => x.sortInPlace (1,x(0),x(0)+k) case ((i,l,r),house) if house - k <= l => (i,l,house+k) case ((i,l,r),house) if house > r => (i+1,house,house+k) case acc => acc._1 }._1
Seems like cookies are disabled on this browser, please enable them to open this website
Hackerland Radio Transmitters
You are viewing a single comment's thread. Return to all comments →