Datametica Interview Question

Round 1 Core Java Round 2 Coding Test 2 question (easy for me)