The leetcode test is executed correctly, but an error is reported when submitting

The leetcode test is executed correctly, but an error is reported when submitting

1. The phenomenon and solution are as shown below

Insert image description here

2. Reason:

The two-dimensional array is not initialized to all 0s. As a result, the data is overwritten during testing, making the values ​​of the two-dimensional array unstable.

3. Solution:

Variable initialization.
Be sure to initialize variables, arrays, etc.

Guess you like

Origin blog.csdn.net/sinat_29891353/article/details/127012085