Answers for "cpp unordered_map has key"

C++
0

cpp unordered_map has key

// Function to check if the key is present or not
string check_key(map<int, int> m, int key)
{
    // Key is not present
    if (m.find(key) == m.end())
        return "Not Present";
  
    return "Present";
}
Posted by: Guest on April-08-2021

Browse Popular Code Answers by Language