Skip to main content

Total Outfit Combinations

EasyPremium

You are given a wardrobe containing pants, shirts, and hats. Along with the total number of each type of clothing (pants, shirts, and hats), you are also provided with the number of unique types of each clothing item.

Each item of clothing can be combined with any other items to form an outfit. An outfit consists of one pair of pants, one shirt, and optionally one hat.

Write a function count_unique_outfits to determine the total number of unique outfit combinations you can create, including outfits with and without hats.

Python
def count_unique_outfits(total_pants: int, unique_pants: int, total_shirts: int, unique_shirts: int, total_hats: int, unique_hats: int) -> int: pass

Input:

  • total_pants (int): The total number of pants in the wardrobe. (1 ≤ total_pants ≤ 1000)
  • unique_pants (int): The number of unique types of pants. (1 ≤ unique_pantstotal_pants)
  • total_shirts (int): The total number of shirts in the wardrobe. (1 ≤ total_shirts ≤ 1000)
  • unique_shirts (int): The number of unique types of shirts. (1 ≤ unique_shirtstotal_shirts)
  • total_hats (int): The total number of hats in the wardrobe. (1 ≤ total_hats ≤ 1000)
  • unique_hats (int): The number of unique types of hats. (1 ≤ unique_hatstotal_hats)

Output:

  • Returns an integer representing the total number of unique outfit combinations, including outfits with and without hats.

Example

Python
count_unique_outfits(2, 1, 1, 1, 3, 2) # returns 3

Given 2 identical pants, 1 unique shirt, and 3 hats (2 unique types), the are 18 unique outfit combinations. We can visualize it as follows:

  • You have 2 red pants
  • You have 1 blue shirt
  • You have 2 white hats and 1 black hat

The unique outfits available to you:

  1. red pants + blue shirt + no hat
  2. red pants + blue shirt + white hat
  3. red pants + blue shirt + black hat

Thus, you can create 3 unique outfits based on what you have in your wardrobe.