Ericsson interview question

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