Skip to content
DeepForgeby svx
All problems
EasyData Structuresds-260

Tombstones Count

Problem

Count deletion markers in an SSTable entry list.

entries is a list of [key, value] pairs where a value of None is a tombstone representing a deletion.

Return the number of tombstones.

Hint

Tombstones must be counted because they suppress older values during merges.

Test cases

case 1
in: [[[1,"a"],[2,null],[3,"b"],[4,null]]]
expected: 2
case 2
in: [[]]
expected: 0
case 3
in: [[[1,null]]]
expected: 1
case 4
in: [[[1,"x"]]]
expected: 0
Starter codePython
def count_tombstones(entries):
    # Your code here
    pass

4 test cases · run your code against them in the editor