Skip to content
DeepForgeby svx
All problems
EasyNLPnlp-044

Boolean OR Query

Problem

Return the sorted union of two posting lists, treating them as sets of document ids.

Duplicate postings are ignored, and two empty lists yield an empty list.

Hint

The | operator builds the union of two sets, then sorted orders it.

Test cases

case 1
in: [[1,2,3],[2,3,4]]
expected: [1,2,3,4]
case 2
in: [[],[1]]
expected: [1]
case 3
in: [[1,2],[2,1]]
expected: [1,2]
case 4
in: [[],[]]
expected: []
Starter codePython
def boolean_or(postings1, postings2):
    # Your code here
    pass

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