6 kyu

Build a pile of Cubes

24,201 of 89,914g964

Description:

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 n3 n^3 , the cube above will have volume of (n1)3 (n-1)^3 and so on until the top which will have a volume of 13 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 n3+(n1)3+(n2)3+...+13=m n^3 + (n-1)^3 + (n-2)^3 + ... + 1^3 = m if such a n exists or -1 if there is no such n.

Examples:

findNb(1071225) --> 45

findNb(91716553919377) --> -1

Mathematics
Algorithms

Similar Kata:

Stats:

CreatedJun 30, 2015
PublishedJun 30, 2015
Warriors Trained257696
Total Skips67021
Total Code Submissions354379
Total Times Completed89914
C# Completions5041
Java Completions9086
Ruby Completions2476
Python Completions31944
JavaScript Completions24201
CoffeeScript Completions76
Haskell Completions591
Clojure Completions158
Elixir Completions265
TypeScript Completions1892
C++ Completions4935
PHP Completions2293
Crystal Completions30
F# Completions112
C Completions2861
Swift Completions748
Rust Completions1439
Go Completions1918
R Completions241
Shell Completions47
OCaml Completions28
Fortran Completions38
Julia Completions94
NASM Completions36
Nim Completions26
Scala Completions277
Kotlin Completions738
Groovy Completions24
Dart Completions438
Pascal Completions26
Raku Completions14
Perl Completions45
COBOL Completions15
Elm Completions11
D Completions10
Erlang Completions20
Prolog Completions16
Total Stars3082
% of votes with a positive feedback rating86% of 8410
Total "Very Satisfied" Votes6393
Total "Somewhat Satisfied" Votes1720
Total "Not Satisfied" Votes297
Total Rank Assessments34
Average Assessed Rank
6 kyu
Highest Assessed Rank
4 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • g964 Avatar
  • NaMe613 Avatar
  • Chrono79 Avatar
  • naithar Avatar
  • kazk Avatar
  • JohanWiltink Avatar
  • monadius Avatar
  • Awesome A.D. Avatar
  • hobovsky Avatar
  • uniapi Avatar
  • xavierguihot Avatar
  • solitude Avatar
  • trashy_incel Avatar
  • user8436785 Avatar
  • akar-0 Avatar
  • Just4FunCoder Avatar
  • KayleighWasTaken Avatar
  • saudiGuy Avatar
Ad