Maximum Weight in Two Bags (double knapsack).
Asked in the OA stage. Given item weights and the capacities of two bags, place each item in at most one bag, or leave it unused, to maximize the total weight carried.
Implement max_weight_two_bags(weights, capacity1, capacity2). Return the maximum total weight that can fit in both bags.
def max_weight_two_bags(weights, capacity1, capacity2):