Skip to main content
5 of 5
add new test cases for duplicate chars in meal
Surculose Sputum
  • 8.4k
  • 1
  • 13
  • 40

Python 2, 95 71 70 55 bytes

lambda i,m:min(i.count(c)/m.count(c)for c in m if" "<c)

Try it online!

Input: Ingredients i as a comma-separated string, and a meal m as a string.
Output: Max number of meals that can be made.

How: Divides the frequency of each character in the ingredient by its corresponding character in the meal, then takes the minimum.

Surculose Sputum
  • 8.4k
  • 1
  • 13
  • 40