DXC Technology Hiring | Minimum Number of Days to Eat N Oranges | Online Assessment question 2024

Question · Posted Jun 2026

Problem Statement You are given n oranges. Every day, you can perform one of the following operations: Eat one orange. If n is divisible by 2, eat n/2 oranges. Remaining oranges = n/2 If n is divisible by 3, eat 2 * (n/3) oranges. Remaining oranges = n/3 Return the minimum number of days required to eat all the oranges. Example 1 Input n = 10 Output 4 Explanation One optimal sequence: Day 1: Eat 1 orange → 9 oranges ...

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

Log in Create a free account