Using Map in C++ O(N)
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int furthestDistanceFromOrigin(string moves) {\n        int n = moves.size();\n        map<char, int> mp;\n        for (int i = 0; i < n; i++) {\n            mp[moves[i]]++;\n        }\n        if (mp.count(\'R\') == 0 || mp.count(\'L\') == 0) {\n            return n;\n        }\n        int left = mp[\'R\'];   // Corrected: use mp[\'R\'] instead of mp.count(\'R\')\n        int right = mp[\'L\'];  // Corrected: use mp[\'L\'] instead of mp.count(\'L\')\n        int us = mp[\'_\'];\n        return max(us + abs(left-right), us + abs(right-left));\n    }\n};\n```
['C++']