Salesforce interview question

LC question easy and med difficulty