-5
0
Find out the dimension of a simple nested list:
[] -> 1
[[]] -> 2
[[[]]] -> 3
...
List taken as input, dimension as output. No counting length of strings - list manipulation and loops only. i.e. no getting the length of the input and dividing by 2.
Any language is permitted. Get golfing!
3Isn't it just counting the number of
[
? – Morgan Thrapp – 2016-10-06T18:10:33.787Good idea, but that is a loophole, so I will make that illegal. @MorganThrapp – Geno Racklin Asher – 2016-10-06T18:11:45.843
2@WheatWizard I'd say no, only because this doesn't actually require any parsing. Now, it's probably going to end up being a dupe of that, but it's not currently. – Morgan Thrapp – 2016-10-06T18:11:58.113
3
Okay, so I'll count the number of
– Morgan Thrapp – 2016-10-06T18:13:02.453]
. Or divide the length of the input by 2. This challenge in its current state is trivial. The sandbox is a great place to get input on your challenges before posting them.4
Read about patching out approaches.
– xnor – 2016-10-06T18:23:15.0602
avoid Do X without Y. In Python the
– Linus – 2016-10-06T18:32:40.193len()
function works for list so I could claimprint len(raw_input())/2
is list manipulation, not string counting.Is my 1 byte Retina answer as valid as the Jelly one? – NoOneIsHere – 2016-10-06T21:21:31.747