Show newer

@vaporeon_ I'm pretty embarrassed about it because my original solution was something I found empirically and I didn't even understand how it worked until I played around with it a bit and then realized the math I was doing was algebraically equivalent to modulus math

But then everyone is just like "oh its just M % N, obviously" and I'm like oh

@vaporeon_ I mean, I think the most interesting part of the problem is just realizing that the remainder/modulus gives you what you need to solve the problem efficiently

So the return type of the data isn't really the heart of the question

I didn't go through your code with a fine tooth comb but it was clear to me from your comment beforehand that you had the right approach

I remember when Holly boosted one of her posts and I went to comment at how good she was at Posting, only to see that I had commented on the post months before with the exact same sentiment

@vaporeon_ hm, i don't know haha. if i were to try to get better at golfing i would start trying random problems on the code golf stack exchange, never more than an hour each, and then compare my results to those written in the language of my choice

@vaporeon_
golfing is a skill and is hard. on the topic of whether C is good at it or not, I can't say for sure as I am not an expert in golfing or C. I would think it is difficult because newer languages come with bigger standard libraries than C which gives you all sorts of tools and shortcuts

But then again when I look at entries to the C Obfuscation Contest thingy, I forgot what it's called, it's absolutely insane the concise and cursed things people can do with macros

re: spoilers maybe? 

@aschmitz what do you mean exactly?

re: spoilers maybe? 

@aschmitz yeah thats what it is

That girl crazy and sleep deprived.
She a yawndere

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!)

wow i just had a program fail because of floating point error, i have never had to deal with this before lol

@aescling SA1 to 06 sonic was a personification of freedom and agency while post-unleashed sonic is an impetuous dumbass

Show older
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.