Haskell Dominator
dominator :: [Int] -> Int
dominator a
  | count > length a `div` 2 = index
  | otherwise                = -1
  where
    (size, value, index) = foldl step (0, 0, 0) (zip [0 ..] a)
    step (sz, val, idx) (k, v)
      | sz == 0   = (1, v, k)
      | val /= v  = (sz - 1, val, idx)
      | otherwise = (sz + 1, val, idx)

    candidate = if size > 0 then value else -1
    count     = length (filter (== candidate) a)

This finds a value that appears in more than half of the array, then returns one valid index for it.