Skip to main content
added 367 characters in body
Source Link
Neil
  • 184.4k
  • 12
  • 76
  • 290

Charcoal, 1616 13 bytes

W¬›×⌊θLθ¹⊞υ⊟θILυIL⊟⪪⭆A›×ι⊕κ¹1 

Try it online! Link is to verbose version of code. Requires input sorted in descending order. Edit: Saved 3 bytes after following @DominicvanEssen's advice. Explanation:

W¬›×⌊θLθ¹ A Input array 

While a (last) crowd member's threshold is not too high...

⊞υ⊟θ ⭆ Map over elements and join 

... move the member from the crowd to the helper pool.

ILυ κ Current index ⊕ Incremented × Multiplied by ι Current value › Is greater than ¹ Literal `1` ⪪ Split on 1 Literal string `1`  ⊟ Pop last element L Length I Cast to string Implicitly print 

Print the final size of the helper pool.

Charcoal, 16 bytes

W¬›×⌊θLθ¹⊞υ⊟θILυ 

Try it online! Link is to verbose version of code. Requires input sorted in descending order. Explanation:

W¬›×⌊θLθ¹ 

While a (last) crowd member's threshold is not too high...

⊞υ⊟θ 

... move the member from the crowd to the helper pool.

ILυ 

Print the final size of the helper pool.

Charcoal, 16 13 bytes

IL⊟⪪⭆A›×ι⊕κ¹1 

Try it online! Link is to verbose version of code. Requires input sorted in descending order. Edit: Saved 3 bytes after following @DominicvanEssen's advice. Explanation:

 A Input array  ⭆ Map over elements and join  κ Current index ⊕ Incremented × Multiplied by ι Current value › Is greater than ¹ Literal `1` ⪪ Split on 1 Literal string `1`  ⊟ Pop last element L Length I Cast to string Implicitly print 
Source Link
Neil
  • 184.4k
  • 12
  • 76
  • 290

Charcoal, 16 bytes

W¬›×⌊θLθ¹⊞υ⊟θILυ 

Try it online! Link is to verbose version of code. Requires input sorted in descending order. Explanation:

W¬›×⌊θLθ¹ 

While a (last) crowd member's threshold is not too high...

⊞υ⊟θ 

... move the member from the crowd to the helper pool.

ILυ 

Print the final size of the helper pool.