Skip to content

3363. Find the Maximum Number of Fruits Collected #2022

Answered by mah-shamim
mah-shamim asked this question in Q&A
Discussion options

You must be logged in to vote

We need to maximize the number of fruits collected by three children moving through an n x n grid of rooms. Each child starts at a different corner of the grid and moves towards the bottom-right corner (n-1, n-1) in exactly n-1 moves, following specific movement rules. The challenge is to compute the maximum total fruits collected, considering that if multiple children visit the same room, the fruits in that room are counted only once.

Approach

  1. Problem Analysis:

    • Child 1 (starts at (0,0)): Must move diagonally (to (i+1, j+1)) each time to reach (n-1, n-1) in exactly n-1 moves. Thus, Child 1's path is fixed: (0,0) → (1,1) → ... → (n-1, n-1). The fruits collected along this diagonal are s…

Replies: 1 comment 2 replies

Comment options

mah-shamim
Aug 7, 2025
Maintainer Author

You must be logged in to vote
2 replies
@topugit
Comment options

topugit Aug 7, 2025
Collaborator

@mah-shamim
Comment options

mah-shamim Aug 7, 2025
Maintainer Author

Answer selected by topugit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested hard Difficulty
2 participants