Baseline: tree as shared
This commit is contained in:
1679 files changed
+1024562
No files matched your search
@@ -0,0 +1,22 @@
|
||||
# probe: a Set: add, membership, size, and iteration order
|
||||
# status: the expected output is Programming+'s interpreter's prediction; corpus.py verify confirms or refutes it on godbolt
|
||||
# expect-stdout: unique: 4
|
||||
# expect-stdout: 4
|
||||
# expect-stdout: 1
|
||||
# expect-stdout: 9
|
||||
# expect-stdout: 7
|
||||
# expect-stdout: dups: [4, 1, 9]
|
||||
from std.collections import Set
|
||||
|
||||
|
||||
def main():
|
||||
var seen = Set[Int]()
|
||||
var dups = List[Int]()
|
||||
for x in [4, 1, 4, 9, 1, 7, 9]:
|
||||
if x in seen:
|
||||
dups.append(x)
|
||||
seen.add(x)
|
||||
print("unique:", len(seen))
|
||||
for x in seen:
|
||||
print(x)
|
||||
print("dups:", dups)
|
||||
Reference in new issue
Block a user