力扣报错:runtime error: reference binding to null pointer of type 'std::vector<int
出错原因:
有for循环或者while时,没有考虑数组为空的情况,且将判断数组为空条件写在比较靠下的位置了,比如下面时错误的:
解决方案:
判断数组为空条件写在最前面:
力扣报错:runtime error: reference binding to null pointer of type 'std::vector<int
出错原因:
有for循环或者while时,没有考虑数组为空的情况,且将判断数组为空条件写在比较靠下的位置了,比如下面时错误的:
解决方案:
判断数组为空条件写在最前面: