Tap here to switch tabs
Problem
Submissions

Problem: Create Grid With Exactly K Paths I

Try to solve the Create Grid With Exactly K Paths I problem.

Statement

You are given three integers m, n, and k.

Construct an m ×\times n grid of characters representing a matrix where:

  • '.' represents an empty cell.

  • '#' represents an obstacle.

A valid path starts at the top-left cell (0, 0) and ends at the bottom-right cell (m - 1, n - 1), moving only one cell right or one cell down at each step, without visiting any obstacle cell.

Return a list of strings representing any valid m ×\times n grid that has exactly k distinct valid paths from (0, 0) to (m - 1, n - 1). If no such grid can be formed, return an empty list.

Note: If there are multiple valid answers, you may return any of them.

Constraints:

  • 1≤1 \leq m, n ≤10\leq 10

  • 1≤1 \leq k ≤4\leq 4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Create Grid With Exactly K Paths I

Try to solve the Create Grid With Exactly K Paths I problem.

Statement

You are given three integers m, n, and k.

Construct an m ×\times n grid of characters representing a matrix where:

  • '.' represents an empty cell.

  • '#' represents an obstacle.

A valid path starts at the top-left cell (0, 0) and ends at the bottom-right cell (m - 1, n - 1), moving only one cell right or one cell down at each step, without visiting any obstacle cell.

Return a list of strings representing any valid m ×\times n grid that has exactly k distinct valid paths from (0, 0) to (m - 1, n - 1). If no such grid can be formed, return an empty list.

Note: If there are multiple valid answers, you may return any of them.

Constraints:

  • 1≤1 \leq m, n ≤10\leq 10

  • 1≤1 \leq k ≤4\leq 4