leetcode常见错误

1 runtime error: load of null pointer of type ‘std::_Bit_type‘ (aka ‘unsigned long‘) (stl_bvector)

力扣:runtime error: load of null pointer of type ‘std::_Bit_type‘ (aka ‘unsigned long‘) (stl_bvector)_runtime error: load of null pointer of type 'std::-CSDN博客icon-default.png?t=N7T8https://blog.csdn.net/weixin_43894075/article/details/114361776

后面参考了很多大神的代码,发现对于vector的初始化,并不是用类似:

vector isUsed(false,nums.size());
而是用resize()函数。

vector isUsed;
isUsed.resize(nums.size(), false);

你可能感兴趣的:(C及python语言学习,leetcode,算法,职场和发展)