简单算法如下, 核心思路是值域有限,转化成反函数
bool isUsedByA[256] = {0};
bool isUsedByB[256] = {0};
for each value in a[]
begin
isUsedByA[static_cast<unsigned char>(value)] = true;
end
for each char_elem in b[]
begin
isUsedByB[static_cast<unsigned char>(value)] = true;
end
define buffer c
step idx from 0 to 255
begin
if (isUsedByA[idx] && !isUsedByB[idx])
{
c.push_back(idx);
}
end
简单算法
最新推荐文章于 2024-11-10 21:43:58 发布