LeetCode 924: Minimize Malware Spread I'm posting my code for a LeetCode problem copied here. If you would like to review, please do so. Thank you for your time!
Problem

In a network of nodes, each node i is directly connected to another
node j if and only if graph[i][j] = 1.
Some nodes initial are initially infected by malware.  Whenever two
nodes are directly connected and at least one of those two nodes is
infected by malware, both nodes will be infected by malware.  This
spread of malware will continue until no more nodes can be infected in
this manner.
Suppose M(initial) is the final number of nodes infected with
malware in the entire network, after the spread of malware stops.
We will remove one node from the initial list.  Return the node that
if removed, would minimize M(initial).  If multiple nodes could be
removed to minimize M(initial), return such a node with the smallest
index.
Note that if a node was removed from the initial list of infected
nodes, it may still be infected later as a result of the malware
spread.

Inputs
[[1,1,0],[1,1,0],[0,0,1]]
[0,1]

[[1,0,0,0],[0,1,0,0],[0,0,1,1],[0,0,1,1]]
[3,1]

[[1,0,0],[0,1,0],[0,0,1]]
[0,2]

[[1,1,1],[1,1,1],[1,1,1]]
[1,2]

Outputs
0

3

0

1

Code
#include &lt;vector&gt;
#include &lt;algorithm&gt;

struct Solution {
    std::vector&lt;int&gt; parents;
    inline int minMalwareSpread(const std::vector&lt;std::vector&lt;int&gt;&gt; &amp;graph, const std::vector&lt;int&gt; &amp;initial) {
        size_t length = graph.size();

        for (size_t index = 0; index &lt; length; index++) {
            parents.push_back(index);
        }

        for (size_t row = 0; row &lt; length; row++) {
            for (size_t col = row + 1; col &lt; length; col++) {
                if (graph[row][col]) {
                    union_uf(row, col);
                }
            }
        }

        std::vector&lt;int&gt; areas(length, 0);
        std::vector&lt;int&gt; malwares(length, 0);

        for (size_t area = 0; area &lt; length; area++) {
            areas[find(area)]++;
        }

        for (size_t init : initial) {
            malwares[find(init)]++;
        }

        std::vector&lt;int&gt; min_spread = {1, 0};

        for (int init : initial) {
            min_spread = std::min(min_spread, {(malwares[find(init)] == 1) * (-areas[find(init)]), init});
        }

        return min_spread[1];
    }

private:
    const inline size_t find(const size_t x) {
        if (x != parents[x]) {
            parents[x] = find(parents[x]);
        }

        return parents[x];
    }

    const inline void union_uf(const size_t x, const size_t y) {
        parents[find(x)] = find(y);
    }
};

Algorithm
You can read about various algorithms here in this link:

We'd first map the graph using Disjoint Set Union (DSU).
We'd count all areas as well as all infected sets.
If there'd be only one malware set, we would return the largest. Otherwise, we'd return the set with lowest index using the last loop.

References

Problem

Solution

Discuss

Union Find
Function prefix qualifiers
I seem to remember this being covered in your reviews before, but:
const inline size_t find(const size_t x)

This benefits from neither of the const declarations nor the inline. Both the return value and the argument are passed-by-value scalars and do not benefit from const. inline, for all intents and purposes, has no effect, particularly where a compiler is told to optimize your code - and even if it did have an effect, it's a bad idea to tell the optimizer what it should and shouldn't inline. It will understand what's good for your code better than the programmer does 99% of the time.
If these concepts are confusing or difficult to apply to code on a practical basis, that is understandable - feel free to ask follow-up questions.