Appian interview question

DSA questions , some logical puzzles