title: Frequent Element Array 1
signature: func frequentElementArray1(arr []int, n int) int {
source_py: def frequent_element_array_1(arr, n):
      Hash = dict()
      for i in range(n):
          if (arr[i] in Hash.keys()):
              Hash[arr[i]] += 1
          else:
              Hash[arr[i]] = 1
      max_count = 0
      res = (- 1)
      for i in Hash:
          if (max_count < Hash[i]):
              res = i
              max_count = Hash[i]
      return res
source_cpp: int frequent_element_array_1(vector<int> arr, int n) {
    unordered_map < int, int > hash;
    for ( int i = 0;
    i < n;
    i ++ ) hash [ arr [ i ] ] ++;
    int max_count = 0, res = - 1;
    for ( auto i : hash ) {
      if ( max_count < i . second ) {
        res = i . first;
        max_count = i . second;
      }
    }
    return res;
  }