You are given two integers m and n representing the dimensions of a rectangular piece of wood of height m and width n. You are also given a prices, where prices[i] = h_i and width w_i can be sold for price_i money.
You can perform any number of horizontal or vertical cuts on a piece of wood to divide it into two smaller rectangular pieces. Each resulting piece can subsequently be cut further in the same manner. Any piece of wood with dimensions matching an entry in prices can be sold. A piece can also be left uncut or unsold.
Return the maximum amount of money that can be earned after cutting and selling the pieces.
Note: Pieces of wood cannot be rotated. A piece of wood of height
hand widthwis not equivalent to a piece of wood of heightwand widthhunlesshequalsw.
Constraints:
m, n
prices.length
prices[i].length
h_i m
w_i n
price_i
All the shapes of wood (h_i, w_i) are pairwise distinct.
You are given two integers m and n representing the dimensions of a rectangular piece of wood of height m and width n. You are also given a prices, where prices[i] = h_i and width w_i can be sold for price_i money.
You can perform any number of horizontal or vertical cuts on a piece of wood to divide it into two smaller rectangular pieces. Each resulting piece can subsequently be cut further in the same manner. Any piece of wood with dimensions matching an entry in prices can be sold. A piece can also be left uncut or unsold.
Return the maximum amount of money that can be earned after cutting and selling the pieces.
Note: Pieces of wood cannot be rotated. A piece of wood of height
hand widthwis not equivalent to a piece of wood of heightwand widthhunlesshequalsw.
Constraints:
m, n
prices.length
prices[i].length
h_i m
w_i n
price_i
All the shapes of wood (h_i, w_i) are pairwise distinct.