6
3
Let a function receive two integers i
and j
between 0
and 3
, it should return the value in position (i,j)
in the following 2D array:
1, 0, -1, 0
1, 0, -1, 0
0, 1, 0, -1
0, -1, 0, 1
Shortest code in any variant of C / C++ wins.
16Why limit this to C/C++? – Kendall Frey – 2014-01-14T01:52:30.967
4probably because the author realizes it is 3-4 chars in golfscript, and wants to make the competition more fair – mniip – 2014-01-14T13:32:25.180
3@Kendall Frey - Actually the true code golf contests are possible only when they target single language (or family of languages). Because there is no point to compete when someone is running on foot, someone is swimming, and others use helicopter. – SergeyS – 2014-01-15T07:59:22.080
2@mniip - I do not think this is 3 or 4 characters. I think it is about best C/C++ solution minus length of
return
keyword ;) – SergeyS – 2014-01-15T08:10:31.1501@SergeyS Even if I agreed, the rest of the site does not. Language-specific questions are discouraged here. – Kendall Frey – 2014-01-15T12:50:49.053
By the way, do you had in mind some truth-table approach when proposing the question? – Gabriele D'Antona – 2014-01-15T13:11:11.567
How is this unclear? – Stan Strum – 2018-01-10T17:17:19.580