Skip to content

Instantly share code, notes, and snippets.

@msg555
Last active August 29, 2015 14:23
Show Gist options
  • Save msg555/4a6723c26b9616964f94 to your computer and use it in GitHub Desktop.
Save msg555/4a6723c26b9616964f94 to your computer and use it in GitHub Desktop.
/* Correct answer is "OK". Most solutions incorrectly identify
* (4, 5) as a deadlock despite it not being reachable.
*/
int NumberOfOperations(long long i) {
return 8;
}
int GetOperation(long long i, long long index) {
int op1[] = {1, 2, -2, 3, 2, -2, -1, -3};
int op2[] = {1, 2, 3, -1, -3, 3, -3, -2};
return (i ? op2 : op1)[index];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment