Your task is to construct a building which will be a pile of n cubes.
The cube at the bottom will have a volume of n^3, the cube above 
will have  volume of (n-1)^3 and so on until the top which will have a volume of 1^3.

You are given the total volume m of the building.
Being given m can you find the number n of cubes you will have to build?

The parameter of the function findNb `(find_nb, find-nb, findNb)` will be an integer m
and you have to return the integer n such as
n^3 + (n-1)^3 + ... + 1^3 = m
if such a n exists or -1 if there is no such n.

## Examples:
```
findNb(1071225) --> 45
findNb(91716553919377) --> -1
```

Difficulty: introductory

Starter code:

def find_nb(m):
	

Solutions:
def find_nb(m):
    n = 1
    volume = 0
    while volume < m:
        volume += n**3
        if volume == m:
            return n
        n += 1
    return -1

def find_nb(m):
    n=s=0
    while True:
      n+=1
      s+=n
      k=s*s
      if k== m:
          return n
      elif k>m:
          return -1 


def find_nb(m):
    i,sum = 1,1
    while sum < m:
        i+=1
        sum+=i**3
    return i if m==sum else -1

def find_nb(m):
    '''
    n cube sum m = (n*(n+1)//2)**2
    then n**2 < 2*m**0.5 < (n+1)**2
    and we can proof that for any n, 0.5 > (2*m**0.5)**0.5 - n**2 > 2**0.5 - 1 > 0.4
    '''
    n = int((2*m**0.5)**0.5)
    if (n*(n+1)//2)**2 != m: return -1
    return n

def find_nb(m):
  total, i = 1, 2
  while total < m:
    total += i * i * i
    i += 1
  return i - 1 if total == m else -1

def find_nb(m):
    n = 0
    while (m > 0):
        n += 1
        m -= n**3
    return n if m == 0 else -1

def find_nb(m):
    l = 1
    while m > 0:
        m -= l**3
        l += 1
    return l-1 if m == 0 else -1

def find_nb(m):
    try:
        vol = int(m)
    except TypeError:
        return -1
    
    partial_sum = 0
    i = 0
    while partial_sum < vol:
        i += 1
        partial_sum += i**3
    
    if vol == partial_sum:
        return i
    else:
        return -1

from decimal import *

def find_nb(m):
    getcontext().prec = 24
    squareRootM = Decimal(m).sqrt()
    squareRootDelta = Decimal(1+8*squareRootM).sqrt()
    num = (squareRootDelta-1)/2
    return num if num % 1 == 0 else -1