Construct an grid so that the number of valid paths from the top-left to the bottom-right is exactly .
Problem
You need to build a grid of size such that the number of valid paths from the top-left cell to the bottom-right cell is exactly .
A path is formed by moving through the grid according to the rules given by the problem. Your task is to output one grid construction that satisfies the requirement whenever possible.
Because this is a construction problem, there may be many valid answers. Any grid that produces exactly paths is acceptable.
What you need to return
Return a valid grid representation meeting the required path count.
If no such grid can be constructed for the given parameters, return an empty result as defined by the platform.
Input Format
- The input contains the grid dimensions and the target path count .
- All values are integers.
- The exact grid encoding follows the platform's expected return format.
Output Format
- Return a grid satisfying the required number of paths.
- If multiple grids are valid, any one is accepted.
- If it is impossible, return the platform-specific empty output.
Constraints
- Grid dimensions and are positive integers.
- The exact limits are platform-specific and not provided here.
- The construction should be efficient enough for interview settings.
Example 1
Input
m = 2, n = 2, k = 2
Output
[[1, 1], [1, 1]]
Explanation
This illustrative example shows a simple grid where the number of valid paths is exactly 2 under the usual right-and-down path model.
Premium problem context
Unlock deeper context for this problem
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.