HCLTech interview question

2 coding Questions one is difficult and other one is easy