C++ In Visual Studio the cases passed, but not here

  • 0

    below c++ code return correct result in VS, but failed for case [1,2,3,4]. what's the difference?

     int findLHS(vector<int>& nums) {
            unordered_map<int,int> umap;
            for(int j:nums) umap[j]++;
            int res=0;
            for(auto it=umap.begin(); it!=umap.end(); it++)
            return res;

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.