Really like this one! It's have a perfect balance between complexity and simplicity. My only suggestion is maybe make description is more explicit? I was need to read the Wikipedia before start because I don't understand how cypher work. Or maybe it's just me.
I think this solution is fit perfect for given description. The only one thing which I would correct is implode($arr). There is no need in delimiter at all.
(
๐
โ
1
)
3
+
(
๐
โ
2
)
3
+
.
.
.
+
1
3
๐
n
3
+(nโ1)
3
+(nโ2)
3
+...+1
3
=m if such a n exists or -1 if there is no such n.
OP has implemented the logic, it is basically summation of cubes of numbers from 1 to ... until it reaches or surpasses
$m
I'm looking atht explination and just don't understand how it works. I'm going to have to study the wiki for this one as well.
This comment is hidden because it contains spoiler information about the solution
I agree. I think test cases doesn't cover all. In my first solution I skip lower case everything except first character and I pass it.
Really like this one! It's have a perfect balance between complexity and simplicity. My only suggestion is maybe make description is more explicit? I was need to read the Wikipedia before start because I don't understand how cypher work. Or maybe it's just me.
I think this solution is fit perfect for given description. The only one thing which I would correct is implode($arr). There is no need in delimiter at all.
This comment is hidden because it contains spoiler information about the solution
str_split() is one which I need to remember. Doesn't use it and create arrays from strings in a strange manner.
Doesn't know that first parameter is optional, thank to you will be use it in future :)
I know there must be function for that but I can't find it in PHP manual and don't want to just google it. Thank you for sharing your knowlendge!