Walmart | OA | 2022 | Coding Round

Walmart · Question · Posted Apr 2026

You are given two integers as input "N" and "M" . You have to distribute "M" candies to "N" children such that each one of them gets atleast one candy after the distribution. Also , each child should get equal number of candies. Find maximum number of candies each child can get . If its not possible to do so , print -1. Input : N = 2 M = 5 Output : 2 (You have 5 candies . You ...

The full answer & interview discussion are available to premium members.

Log in Create a free account