Skip to content

Instantly share code, notes, and snippets.

@rtsoy
Created January 2, 2026 07:42
Show Gist options
  • Select an option

  • Save rtsoy/f00629d1f9cd6181e83129e97767892e to your computer and use it in GitHub Desktop.

Select an option

Save rtsoy/f00629d1f9cd6181e83129e97767892e to your computer and use it in GitHub Desktop.
136. Single Number
// https://leetcode.com/problems/single-number/
//
// Time: O(n)
// Space: O(1)
//
// n - number of elements in array
// .................... //
func singleNumber(nums []int) int {
res := 0
for _, num := range nums {
res ^= num
}
return res
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment