AJACKUS interview question

2 Coding problem medium to high solve in 10mins max each