non-duplicated integer

This Question Was Asked By Google

Given an array of integers where every integer occurs three times except for one integer, which only occurs once, find and return the non-duplicated integer.

Write a function solve that have the following parameter(s):
1.) a = an array of integers

Example
Input:
[6, 1, 3, 3, 3, 6, 6] Output:
1

Explanation
The number that only occurs once is 1 from an array of integers [6, 1, 3, 3, 6, 6].

Example
Input:
[2, 1, 2, 8, 1, 2, 4, 4, 1, 4] Output:
8

Explanation
The number that only occurs once is 8 from an array of integers [2, 1, 2, 8, 1, 2, 4, 4, 1, 4].

Constraints
• The length of an array should be greater than 0 and less than 800.
• The elements of an array should be greater than 0 and less than 1000.