Skip to content
DeepForgeby svx
All problems
EasyData Structuresds-291

Version Vector Dominates Check

Problem

Check whether one version vector dominates another.

a and b are version vectors as lists of integers. a dominates b when every element of a is at least the corresponding element of b, meaning b's history is fully contained in a's. Vectors of different lengths never dominate each other.

Return True or False.

Hint

Dominance is component-wise greater than or equal.

Test cases

case 1
in: [[2,3,1],[1,3,1]]
expected: true
case 2
in: [[1,2],[2,1]]
expected: false
case 3
in: [[0,0],[0,0]]
expected: true
case 4
in: [[],[]]
expected: true
case 5
in: [[1],[1,1]]
expected: false
Starter codePython
def vv_dominates(a, b):
    # Your code here
    pass

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