Faster and Easy to Understand|| C++ || Map
\nclass Solution\n{\npublic:\n    int strToInt(string x)\n    {\n        stringstream temp(x);\n        int num = 0;\n        temp >> num;\n        return num;\
```\nclass Solution\n{\npublic:\n    int strToInt(string x)\n    {\n        stringstream temp(x);\n        int num = 0;\n        temp >> num;\n        return num;\n    }\n    string INTtoStr(int k)\n    {\n        stringstream ss;\n        ss << k;\n        string s;\n        ss >> s;\n        return s;\n    }\n    vector<vector<string>> displayTable(vector<vector<string>> &orders)\n    {\n    //-----------------------------------------------------------------------------\n        set<string> s;\n        for (auto it : orders)\n            s.insert(it[2]);\n        vector<string> v;\n        for (auto it : s)\n            v.push_back(it);\n    //-----------------------------------------------------------------------------\n        map<int, vector<int>> mp;\n        int table;\n        vector<int> temp(s.size(), 0);\n    //-----------------------------------------------------------------------------\n        for (auto it : orders)\n        {\n            table = strToInt(it[1]);\n            if (mp.find(table) == mp.end())\n                mp[table] = temp;\n            int pos = lower_bound(v.begin(), v.end(), it[2]) - v.begin();\n            mp[table][pos]++;\n        }\n    //-----------------------------------------------------------------------------\n        vector<string> row;\n        row.push_back("Table");\n        for (auto it : v)\n            row.push_back(it);\n    \n        vector<vector<string>> ans;\n        ans.push_back(row);\n        row.clear();\n//-----------------------------------------------------------------------------\n        for (auto it : mp)\n        {\n            row.push_back(INTtoStr(it.first));\n            for (auto i : it.second)\n                row.push_back(INTtoStr(i));\n            ans.push_back(row);\n            row.clear();\n        }\n//-----------------------------------------------------------------------------\n        return ans;\n    }\n};\n```
[]