Bitmap index query

Write codeMedium26 minOracle style

Your task

A bitmap index represents each predicate as a list of row positions (0-based) where the predicate is true, given as a SORTED list of ints. Evaluate a boolean query: given bitmaps a, b, c and an operator string, return the sorted list of matching row ids. Supported operators: 'and' = a AND b, 'or' = a OR b, 'and_not' = a AND NOT b, 'and_or' = a AND (b OR c). Each input bitmap is sorted with no duplicates. The result must be sorted ascending with no duplicates.

Examples

bitmap_query(a: list[int], b: list[int], c: list[int], op: str) -> list[int]
Example 1
Inputbitmap_query([0, 1, 2, 3], [2, 3, 4], [], "and")
Output[2, 3]