DEV Community

Discussion on: Daily Challenge #55 - Building a Pile of Cubes

Collapse
 
mattonem profile image
maxmattone

Hoy,
With a reccursive aproach using Emacs Lisp

(cl-defun tower(remainingVol &optional (level 1)) 
  (cond ((< remainingVol 0) 0)
    ((= remainingVol 0) (- level 1))
    (t (tower (- remainingVol (expt level 3)) (+ level 1)))
    )
  )
(tower 1071225)

You might have to increase your max-lisp-eval-depth for great values.