yes. this is a brute-force solution. There is no solution that is 'not brute-force' that will give you a matrix product.
If you look at other solutions for this problem, their attempt is to reduce the size of A and B matrices (by ignoring the zero elements) into look up symbol tables (like hashmap) and then do a product for those values and place them at right positions in matrix C (the result) -- which would also take the same amount of time (amortized time -- not leetcode run time).
The reason this solution takes less time is because this works with primitive types rather than hashmaps or hashtables.
In the interivew, you should answer this question by saying that for sparse matrices, it is a good idea to store the matrices in vectors or hashmaps rather than a two-dimensional array. The interviewer is of course looking for you to code the dot product, but in a way is also looking if you would even save the original information in matrices in the first place or somethig else that is space efficient. That is why you should say, -- "Since you mention these are sparse matrices, I would not even save them as a matrix of zero and non-zero elements, I would simply ignore the zero elements there by reducing the space which in-turn reduces the number of multiplications and hence the time factor as well"
Leetcode should have framed this question not as matrices, but a sparse vectors and some how decipherable for the user to know which locations are zero and which are non-zero (not exactly sure how one would frame that) and then multiply them and return a complete matrix.