Ericsson Interview Question

Asked me to code a question and also a logic based question.