4 ms·
Small nitpick: if !encountered[elements[v]] == true { is a double negative and hard to understand. I'd write it as if !encountered[elements[v]] { or
by ggorlen 4y ago
Small nitpick:
if !encountered[elements[v]] == true {
is a double negative and hard to understand. I'd write it as
if !encountered[elements[v]] {
or if you must use the bare bool,
if encountered[elements[v]] == false {