brute-force C++ permutations
\nclass Solution {\npublic:\n    using VI = vector<int>;\n    using VVI = vector<VI>;\n    int maxCompatibilitySum(VVI& A, VVI& B, int best = 0) {\n        int 
```\nclass Solution {\npublic:\n    using VI = vector<int>;\n    using VVI = vector<VI>;\n    int maxCompatibilitySum(VVI& A, VVI& B, int best = 0) {\n        int M = A.size(),\n            N = A[0].size();\n        sort(A.begin(), A.end());\n        do {\n            auto cand = 0;\n            for (auto i{ 0 }; i < M; ++i)\n                for (auto j{ 0 }; j < N; ++j)\n                    cand += A[i][j] == B[i][j];\n            best = max(best, cand);\n        } while (next_permutation(A.begin(), A.end()));\n        return best;\n    }\n};\n```
[]