class Solution {
public:
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     * 
     * @param weightsA int整型vector 
     * @param weightsB int整型vector 
     * @return int整型
     */
    int findMode(vector<int>& weightsA, vector<int>& weightsB) {
        // write code here
        // map是按照key排序的
        map<int,int> m;
        for(auto weights:weightsA)
            ++m[weights];
        
        for(auto weights:weightsB)
            ++m[weights];
        
        int ans = m.begin()->first;

        for(auto it=m.begin(); it!=m.end(); ++it)
        {
            if(it->second>=m[ans])
                ans = it->first;
        }

        return ans;
    }
};