You are viewing a single comment's thread. Return to all comments →
in scala without actually rotating
def circularArrayRotation(a: Array[Int], k: Int, queries: Array[Int]): Array[Int] = { val kMod = k % a.length queries.map(x => a(if ((x - kMod + a.length) > 0) (x - kMod + a.length) % a.length else 0)) }
Seems like cookies are disabled on this browser, please enable them to open this website
Circular Array Rotation
You are viewing a single comment's thread. Return to all comments →
in scala without actually rotating