Tech Mahindra interview question

Find the smallest GP, Java basics