ABC interview question

all technical with some logical reasoning