100-days-of-rust/Week-01/Day-03_Barbecue-Skewers
2024-07-28 13:57:52 +02:00
..
barbecue_skewers Wrote program for Day 3 2024-07-28 13:57:52 +02:00
README.md Add files via upload 2023-03-23 20:52:21 -04:00

Barbecue Skewers

You are in charge of the barbecue grill. A vegetarian skewer is a skewer that has only vegetables (-o). A non-vegetarian skewer is a skewer with at least one piece of meat (-x).

For example, the grill below has 4 non-vegetarian skewers and 1 vegetarian skewer (the one in the middle).

["--xo--x--ox--",
"--xx--x--xx--",
"--oo--o--oo--",      <<< vegetarian skewer
"--xx--x--ox--",
"--xx--x--ox--"]

Examples

Given a BBQ grill, write a function that returns [# vegetarian skewers, # non-vegetarian skewers]. For example above, the function should return [1, 4].

 [
  "--oooo-ooo--",
  "--xx--x--xx--",
  "--o---o--oo--",
  "--xx--x--ox--",
  "--xx--x--ox--"
] ➞ [2, 3]

[
  "--oooo-ooo--",
  "--xxxxxxxx--",
  "--o---",
  "-o-----o---x--",
  "--o---o-----"
) ➞ [3, 2]

Notes

  • NA