Equal Products
At one of Amazon’s busy warehouses, Team Alpha and Team Beta are assigned the task of processing n products for shipment. Each product handled by Team Alpha is labeled as inventory_alpha[i], and the corresponding product handled by Team Beta is labeled as inventory_beta[i].
For every product pair (inventory_alpha[i], inventory_beta[i]), Team Alpha is allowed to repeatedly perform the following operation on their product label:
Your task is to determine, for each product pair, whether Team Alpha can transform inventory_alpha[i] into inventory_beta[i] by performing the swap operation any number of times (including zero), while following these constraints:
The original problem asks to return bool[], but I modified it to int[]. 1 represents true, while 0 represents false.
1Example 1

2Example 2
Constraints
Limits and guarantees your solution can rely on.
- 1 ≤
n≤ 10^5 - 1 ≤ |
inventory_alpha[i]|, |inventory_beta[i]| ≤ 2*10^5 - |
inventory_alpha[i]| = |inventory_beta[i]| inventory_alpha[i]andinventory_beta[i]contain only lowercase Latin letters.- The sum of lengths of all strings in
inventory_alphaandinventory_betadoes not exceed 5 * 10^5