summaryrefslogtreecommitdiff
path: root/progs/a714.py
blob: a4ab4478192e7c6e59c0bb11ff2968b68860857f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
def first_Element(arr,n,k): 
    count_map = {}; 
    for i in range(0, n): 
        if(arr[i] in count_map.keys()): 
            count_map[arr[i]] += 1
        else: 
            count_map[arr[i]] = 1
        i += 1
    for i in range(0, n):  
        if (count_map[arr[i]] == k): 
            return arr[i] 
        i += 1 
    return -1