Number of Ways to Cut a Pizza
Given a rectangular pizza represented as a rows x cols matrix containing 'A' (apple) and '.', cut the pizza into k pieces using k-1 cuts. For each cut, you choose the direction: horizontal or vertical, then cut the pizza. The piece given away is either the upper part if horizontal or the left part if vertical. Return the number of ways to cut such that each piece contains at least one apple.
Number of Ways to Cut a Pizza

Given a rectangular pizza represented as a rows x cols matrix containing 'A' (apple) and '.', cut the pizza into k pieces using k-1 cuts. For each cut, you choose the direction: horizontal or vertical, then cut the pizza. The piece given away is either the upper part if horizontal or the left part if vertical. Return the number of ways to cut such that each piece contains at least one apple.

Example 1:
Input: {"pizza":["A..","AAA","..."],"k":3}
Output: 3
Input
arr ={"pizza":["A..","AAA","..."],"k":3}

Pizza: 3x3, need 3 pieces (2 cuts)

State
rows
3
cols
3
pieces
3
pizza
["A..", "AAA", "..."]
Variables
No variables to display
DepthFunction Call
Stack empty
0/1