[Python] Each child covers one region
\nclass Solution:\n    def maxCollectedFruits(self, fruits: List[List[int]]) -> int:\n        # The child starting at (0, 0) has only 1 path from (0, 0) to (n -
```\nclass Solution:\n    def maxCollectedFruits(self, fruits: List[List[int]]) -> int:\n        # The child starting at (0, 0) has only 1 path from (0, 0) to (n - 1, n - 1) with exactly n - 1 step\n        n = len(fruits)\n        for i in range(1, n - 1):\n            fruits[i][i] += fruits[i - 1][i - 1]\n\n        # The child starting at (0, n - 1)\n        # consider the row from 0 to n - 2, the child will be finally moved to (n - 2, n - 1)\n        increase_rc = (n - 2) // 2\n        decrease_rc = increase_rc + (n - 2) % 2\n        smallest_col = n - 1\n        \n        for r in range(n - 1):\n            for c in range(smallest_col, n):\n                if r > 0:\n                    if r <= increase_rc:\n                        t = 0\n                        if c - 1 >= smallest_col + 1:\n                            t = max(t, fruits[r - 1][c - 1])\n                        if c >= smallest_col + 1:\n                            t = max(t, fruits[r - 1][c])\n                        if c + 1 < n:\n                            t = max(t, fruits[r - 1][c + 1])\n                    elif r == decrease_rc and decrease_rc != increase_rc:\n                        t = 0\n                        if c - 1 >= smallest_col:\n                            t = max(t, fruits[r - 1][c - 1])\n                        if c >= smallest_col:\n                            t = max(t, fruits[r - 1][c])\n                        if c + 1 < n:\n                            t = max(t, fruits[r - 1][c + 1])\n                    elif r > decrease_rc:\n                        t = 0\n                        if c - 1 >= smallest_col - 1:\n                            t = max(t, fruits[r - 1][c - 1])\n                        if c >= smallest_col - 1:\n                            t = max(t, fruits[r - 1][c])\n                        if c + 1 < n:\n                            t = max(t, fruits[r - 1][c + 1])  \n                    fruits[r][c] += t\n                \n            if r < increase_rc:\n                smallest_col -= 1\n            elif r >= decrease_rc:\n                smallest_col += 1\n        \n        # The child starting at (n - 1, 0)\n        # consider the column from 0 to n - 2, the child will be finally moved to (n - 1, n - 2)\n        smallest_row = n - 1\n        for c in range(n - 1):\n            for r in range(smallest_row, n):\n                if c > 0:\n                    if c <= increase_rc:\n                        t = 0\n                        if r - 1 >= smallest_row + 1:\n                            t = max(t, fruits[r - 1][c - 1])\n                        if r >= smallest_row + 1:\n                            t = max(t, fruits[r][c - 1])\n                        if r + 1 < n:\n                            t = max(t, fruits[r + 1][c - 1])\n                    elif c == decrease_rc and decrease_rc != increase_rc:\n                        t = 0\n                        if r - 1 >= smallest_row:\n                            t = max(t, fruits[r - 1][c - 1])\n                        if r >= smallest_row:\n                            t = max(t, fruits[r][c - 1])\n                        if r + 1 < n:\n                            t = max(t, fruits[r + 1][c - 1])\n                    elif c > decrease_rc:\n                        t = 0\n                        if r - 1 >= smallest_row - 1:\n                            t = max(t, fruits[r - 1][c - 1])\n                        if r >= smallest_row - 1:\n                            t = max(t, fruits[r][c - 1])\n                        if r + 1 < n:\n                            t = max(t, fruits[r + 1][c - 1])  \n                    fruits[r][c] += t\n                    \n            if c < increase_rc:\n                smallest_row -= 1\n            elif c >= decrease_rc:\n                smallest_row += 1\n\n        return fruits[n - 1][n - 1] + fruits[n - 1][n - 2] + fruits[n - 2][n - 1] + fruits[n - 2][n - 2]\n```
['Python3']