FUNCTIONAL PEARL: Marble mingling

  • Authors:
  • S. A. Curtis

  • Affiliations:
  • University of Stirling, Stirling FK9 4LA, UK (e-mail: s.curtis@cs.stir.ac.uk)

  • Venue:
  • Journal of Functional Programming
  • Year:
  • 2006

Quantified Score

Hi-index 0.00

Visualization

Abstract

A bag (literally and mathematically!) of marbles is deemed to be mingled if all the colours of the marbles are different. Given a positive integer $k$ and a collection of $m$ marbles, our objective is to try and extract as many mingled bags as possible from the collection, where each bag contains exactly $k$ marbles.