Step 3 of 4
Size Tracking & Key Listing
You start from the build so far — your own work where you have written it, the reference build where you have not. Either way this step stands on its own.
Ensure size() and keys() accurately report table state.
size(): Returns the exact number of key-value pairs stored.keys(): Collects and returns an array/list of all keys currently present across all buckets.
Your build
Running is free — Submit is what records the step. Or press ⌘↩
Tests
2 cases| call | type | expected | result |
|---|---|---|---|
| runOps(4, [["size"],["set","a",1],["set","b",2],["size"],["set","a",99],["size"],["delete","b"],["size"]]) | tracks size across sets, updates, and deletes | [0,null,null,2,null,2,true,1] | — |
| runOps(4, [["set","foo",10],["set","bar",20],["set","baz",30],["keys"]]) | lists all stored keys | [null,null,null,["bar","baz","foo"]] | — |
Hints
Stuck? Hints open one at a time, each giving a little more away.
2 hints left