Some error occured while loading page for you. Please try again.
Sort 8 Discussions, By:
Please Login in order to post a comment
which scala collection you used to solve this problem?
it should be stated which column is the first '1' being into, because middle is between 50 and 51 counting from one
I really enjoyed solving this problem, also it was hard. But I don't know if I did it in the right way, because it took me 25 lines of code in F#.
The idea may be summarized by this function:
y :: Int -> String -> [String]
y n branches = replicate n branches ++
take n (iterate grow $ divide branches)
Where divide creates twice more 1's than in the branches string.
Managed to solve it in 24 lines of scala code without variables. Never been so proud of myself.
The checker doesn't seem to enforce the "no val" rule in Scala
It would be nice if the constraints indicate whether n can be 0 or not. I'll assume 1 <= n <= 5.
Finally did a solution in scala
Took some time but it was good to learn
No more comments