Created
July 13, 2020 22:28
-
-
Save bparanj/33939ed48771ffb74de8d94fd738fe80 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def xor_operation(n, start) | |
| number = 0 | |
| for i in (0..n-1) do | |
| number ^= start + 2*i | |
| end | |
| number | |
| end | |
| # Input: n = 5, start = 0 | |
| p xor_operation(4, 3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment