error:control reaches end of non-void function [-Werror=return-type]

Description of problem scenario: Leetcode encountered this kind of error when scanning the question, the code was no problem, but the compilation failed, it was very suspicious of life.
problem solved: add a return statement at the end of the function, as long as the return data type pair! Remember, always return, even if you never need it.
although sometimes we have a return in the same program, but not at the end of the code, leetCode will not compile.
So we also have to return at the end of the function block. When this error occurs, LeetCode usually has a red highlight on the last line of the function block.
(Although I thought of adding the return value, I silently said to myself that it was clearly written in the middle, but there is no use in adding here…)
As shown in figure:

Read More: