BNY interview question

2 coding question related to data structures and algorithms