I encountered a fun coding challenge while programming today.
Suppose you are teaching a class and you brought with yourself a bag of candy to hand out to your students. You want to hand out every piece of candy, but do it in a way that disperses the candy provided to each student as evenly as possible. No student should have more than 1 extra piece of candy than any other student. Exactly which students get the extra pieces of candy does not matter.
Task: Write a function that takes N students and M pieces of candy, where M > N, and returns an array of length N showing the amount candy given to each student.
Followup Task: Generate this array in O(N) time, where N is the number of students (NOT the amount of candy!)
@alas
@alas delete this
@aescling SA1 to 06 sonic was a personification of freedom and agency while post-unleashed sonic is an impetuous dumbass
@Taweret yeah I liked it it was good
@aescling i get it
rage bait
@aescling bash and shell are the same thing what are you talking about
@alas I don't know shit about perl, unfortunately
I stitched two scripts together using python and it was weirdly annoying to do, when in bash it would have just been a simple one-liner with a command substitution
@The_T @vaporeon_ so when you buy a domain apparently the two parts are called the "Top Level Domain" (TLD) and "Second Level Domain" (SLD)
in example.com "example" is the SLD and "com" is the TLD
www.example.com is a subdomain of the domain example.com
@The_T @vaporeon_ like, when I made my blog I purchased clodsire.social
And i put the blog at the subdomain blog.clodsire.social
@The_T @vaporeon_ the domain is example.com and www.example.com is a subdomain
@vaporeon_ massive coffees
@amy hewwo
@SportsGoblin wooooooooooooooooooooooooo
the clodvestigator
i answer to Caleb, Clodsire, Clodboy, Clod, and Bumby. very leftist.
videogame enjoyer. mathematics hobbyist and recovering physicist. recovering software engineer. professional wonk. prophet of The Truth. the walking embodiment of "not diagnosed, but somethings wrong". i like animals that wear cowboy hats.
number of fat cock awards received: 56
header is by @vaporeon_
"i regret ever allowing him here" ~aescling
"oh you're one of those weird movie likers" ~Ti
30+
he/him
sgraMrt