Amazon Interview Question

Q1: divide minimum groups Q2: find the encrypted number