Advertisement
TheRedRover

Untitled

Apr 4th, 2020
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.23 KB | None | 0 0
  1. object Cube {
  2. def helper(sum:BigInt,m:Long,n:BigInt):BigInt=
  3.     {
  4.       if(sum+(n*n*n)<m) helper(sum+(n*n*n),m,n+1)
  5.       else if (m==sum+(n*n*n)) n
  6.       else -1
  7.     }
  8.     def findNb(m: Long):BigInt =
  9.       helper(0,m,1)
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement