If the rectangle fits in , then do not include the current index in subset
if h1 <= h2 and w1 <= w2 : NEW_LINE INDENT ans = max ( ans , findLongest ( a , n , present + 1 , previous ) ) NEW_LINE DEDENT else : NEW_LINE