Got this question in my recent onsite with one of the faang.
Question:
Return true if all the given relations do not create conflict or return false.
Input [["a",">","b"],["b",">","c"]] --> return True (no conflicts)
Input [ ["a",">","b"],["b",">","c"], ["c",">","a"]] --> return False
Input [ ["a",">","b"],["b",">","c"], ["c","<","a"]] --> return True
Input [ ["a",">","b"],["b",">","c"], ["c","<","d"]] --> return True
Follow-up :
given ["a",">","0"],["b","<","a"],["b",">","1"] --> return False
How to approach the follow-up question.