Loading Now

missingValue

You are given an array of positive ints where every element appears three times, except one that appears only once (let’s call it x) and one that appears only twice (let’s call it y).

Find x * x * y

Example

  • For a = [1, 1, 1, 2, 2, 3], the output should be missingValue(a) = 18 (3*3*2 = 18)
  • For a = [27, 65, 44, 39, 44, 21, 21, 44, 65, 39, 21, 65], the output should be missingValue(a) = 28431

Input/Output

  • [execution time limit] 2 seconds

  • [input] array.integer a

    1 <= a.length <= 100

    1 <= a[i] <= 1000
  • [output] integer

    • the value of x * x * y

Post Comment

Contact