Company
Date Published
Feb. 25, 2021
Author
John Graham-Cumming
Word count
785
Language
English
Hacker News points
30

Summary

John Graham-Cumming has shared an interesting approach to dividing employees into random groups for virtual hangouts. He initially wrote a Python code to divide n elements into groups of at least size g, minimizing the size of each group. Later, he simplified the solution by using a formula that calculates how many elements should be in each group without looping. The final code is: `groups = [1+max(0,n-(i+1))//(n//g) for i in range(n//g)]`. This approach helps to ensure fair distribution of employees into groups and promotes interaction among them.