11
1
Is there a way in Golfscript to bring all of the diagonals of an array into a single array?
For example, for the array
[[1 2 3][4 5 6][7 8 9]]
return
[[7][4 8][1 5 9][2 6][3]]
(not necessarily in that order) and for
["ABCD""EFGH""IJKL"]
return
["I""EJ""AFK""BGL""CH""D"]
(not necessarily in that order). Assume the lengths of the arrays are the same.
I am struggling with figuring it out. I tried doing something with =
and iterating through the (length+1)
th character of the strings, but that didn't work. Can someone help me?
I'd like the shortest way to do this, if possible.
This isn't your regular Q&A site; you need to have a winning criterion. I suggest a popularity content for starters. – Timtech – 2014-09-18T23:40:49.563
@Timtech I understand. I'll try regular stackexchange. – Josiah Winslow – 2014-09-18T23:50:17.240
7
Language-specific golf advice questions are officially on-topic: http://meta.codegolf.stackexchange.com/a/1725/20260
– xnor – 2014-09-19T00:02:44.5375
@xnor You linked to wrong answer there. That one is about those tips lists we have. But asking for specific advice is also on topic so it would be nice if people could stop downvoting and close voting this.
– Martin Ender – 2014-09-19T07:22:56.447Tips most definitely are on topic, but should be posted as community wiki. However I'm not convinced that this question should be reopened as the main Golfscrip tips question already has several answers that are as specific as the one requested here. Maybe anyone who has an answer should post it there. http://codegolf.stackexchange.com/q/5264/15599
– Level River St – 2014-09-19T15:45:31.7507@steveverrill I don't agree that these should be made CW. That only applies to the list questions (in fact, I don't even agree that those should be CW), but there's really no reason for specific advice question to be CW - they are basically micro-optimisation golfing contests, and the people answering them do deserve the rep for it (as does the asker, if the question is interesting). – Martin Ender – 2014-09-19T16:21:35.577