Skip to content

Instantly share code, notes, and snippets.

@stevencurtis
Last active June 22, 2020 10:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevencurtis/7f3e915c2b5b7838df10c4a02d475707 to your computer and use it in GitHub Desktop.
Save stevencurtis/7f3e915c2b5b7838df10c4a02d475707 to your computer and use it in GitHub Desktop.
xoroperation
class Solution {
func xorOperation(_ n: Int, _ start: Int) -> Int {
var sum = 0
for i in 0..<n {
sum = sum ^ ( start + (2 * i) )
}
return sum
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment