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博客https://blog.csdn.net/weixin_43894075/article/details/114361776
后面参考了很多大神的代码,发现对于vector的初始化,并不是用类似:
vector<bool> isUsed(false,nums.size());
而是用resize()函数。
vector<bool> isUsed;
isUsed.resize(nums.size(), false);