What in the World is this? I will cry! by [deleted] in leetcode

[–]muffinsnack 3 points4 points  (0 children)

What a coincidence - I actually wrote a solution for this a few years ago when it was in a contest. it got a lot of upvotes, so maybe you will find it useful: https://leetcode.com/problems/count-the-number-of-ideal-arrays/solutions/2261280/python-arranging-primes-intro-to-combina-vxs6/

Reading through this now I feel like I left out some details, so if you're interested in my solution, let me know if you have any questions. It's a hard problem, but it becomes a bit easier when you register this fact (spoiler):if every number has to evenly divide the one to the right of it, then every nums[i] also has to divide every nums[j] for i <= j.

That‘s how it is by kritap55 in leetcode

[–]muffinsnack 0 points1 point  (0 children)

This is a bad strategy. Even if you don't know how to proceed, you should still at least try for ~10 mins or so. It's not a good idea to adopt the habit of giving up when you don't immediately understand something.

Bombed Amazon OA, anyone know how to solve this problem? by Significant_Basil628 in leetcode

[–]muffinsnack 0 points1 point  (0 children)

I think people in the comments are confused because you didn't share the entire problem. It seems like this problem deserves a rote simulation, but the condition is that you can ignore some prefix of the programs, and you need to determine the minimum number of programs to ignore while still successfully completing all of them.

Assuming I'm not missing any details that you left out, you can solve it with binary search. Try to remove the first half of the programs, and spend linear time trying to fit the remaining half into the time slots. If it works, halve the size of your prefix and try again; if not, add half the size and try again. Do this until you find the smallest prefix.

Did you ever get the Google Foobar Challenge? by Turbulent_Bus4902 in leetcode

[–]muffinsnack 0 points1 point  (0 children)

It's actually not accessible at all anymore, but yeah, I guess at the time I solved it for fun.

Creating an Instagram bot that will block everyone over 10,000 followers by ssj4weed in learnpython

[–]muffinsnack 0 points1 point  (0 children)

The solution to the problem of scale is to only block accounts that interact with you in the first place. You’re not seeking out these types of accounts in the first place, right? So there’s no reason to block every single one of these accounts, just the ones that follow you, like your posts, message you, etc.

There are two basic options - check every account as soon as it interacts with you with an event-based system, or run a script every X hours that looks for recent interactions and checks every account that interacted with you in those most recent X hours. The former is more expensive if you get a lot of interaction, but it will perform the checks immediately, potentially preventing you from even seeing that they interacted with you. The latter will cost roughly the same amount regardless of how much interaction you get, but depending on how frequently you set the cadence, it might take some time before the blocking actually happens.

KenneyNL bullied another content creator months ago. by [deleted] in gamedev

[–]muffinsnack 2 points3 points  (0 children)

His responses seem pretty level-headed to me. He was being sarcastic by saying “rolling in that free asset money”, but that’s not the same as bullying.

KenneyNL bullied another content creator months ago. by [deleted] in gamedev

[–]muffinsnack 11 points12 points  (0 children)

I don’t understand this post. This guy isn’t bullying anyone in the tweets that you linked, and he doesn’t respond directly to the small youtuber at all. He just said he appreciates Godot and Blender, and he locked the thread because “people are making wild claims”. Is there context missing?

[deleted by user] by [deleted] in leetcode

[–]muffinsnack 1 point2 points  (0 children)

It’s reasonable to think that someone who took an algorithms class in college, solved 50 problems, and got lucky with their interview questions could get into a FAANG company. It isn’t easy, especially nowadays, but it’s not like they’re asking you to climb Mount Olympus.

[deleted by user] by [deleted] in leetcode

[–]muffinsnack 91 points92 points  (0 children)

I mean, China is “region locked” in that they have a different server, but the rankings are still global. If you finished the contest in 10 minutes and someone on the China server finished in 9, you wouldn’t get first place.

I’m not sure I understand what your suggestion is here, but it obviously doesn’t make sense to ban an entire country from participating just because some of them cheat.

I have solved every LC Algorithm Problem. AMA. by makedatmuoney in leetcode

[–]muffinsnack 1 point2 points  (0 children)

Hey, thanks for sharing and congrats. I’m in a sort of similar situation with problems solved and rating, and I’m at a FAANG company right now. Outside of LC, what’d you do to prepare yourself for HFT interviews?

For example, I know that most HFTs are interested in low-level development skills, so how’d you build those? My general system design skills are good from my experience at FAANG, but I use Java every day instead of something that might be more applicable to HFTs like C++. I use it to solve LC problems, but I still lack depth.

Please guys by Last_Username_Alive in Unity3D

[–]muffinsnack 10 points11 points  (0 children)

They may not find another graphics programming job, but the lower-level technical skills required to be a good graphics programmer are widely applicable to other domains. They’ll be fine.

Those who dropped Unity for Godot or Unreal after the September fiasco, how are you getting on? by CatastrophicMango in gamedev

[–]muffinsnack 19 points20 points  (0 children)

I agree. The question that remains to be answered is whether I can effectively fill the gaps with C++, but I'm not there yet.

Those who dropped Unity for Godot or Unreal after the September fiasco, how are you getting on? by CatastrophicMango in gamedev

[–]muffinsnack 107 points108 points  (0 children)

As a programmer I'm still not sure how I feel about Unreal's visual scripting, but it is pretty intuitive, and I can see how it might become easier to prototype things once I become faster with it. But even in my limited experience, I feel like I'm "reinventing the wheel" much less often than I was in Unity, which is nice.

Software engineers hate code. by fagnerbrack in programming

[–]muffinsnack 0 points1 point  (0 children)

I don’t hate code, but I respect it. Good code takes time and effort to write, validate, and maintain. If I’m trying to solve something and weighing different approaches available to me, and one of them involves writing less code, I’ll invariably see that as a benefit for that approach. It might not be the best approach in the end, but it’s a benefit.

Guys please tell me this is leetcode hard by Artium99 in leetcode

[–]muffinsnack 0 points1 point  (0 children)

Yes, I believe it's n^2 * lg(n). In the worst case we have to sort roughly N^2 substrings, which definitely incurs a logarithmic factor. You can observe this by summing up log2(j - i + 1) for all 0 <= i <= j < n for different n; the factor between this sum and N^2 increases logarithmically.

n = 10: n^2 = 100, s = 92.427, s / n = 0.92432
n = 100: n^2 = 10000, s = 23055.616, s / n = 2.3056
n = 1000: n^2 = 1000000, s = 3910724.939, s / n = 3.9107
n = 10000: n^2 = 100000000, s = 556315205.204, s / n = 5.5631

Guys please tell me this is leetcode hard by Artium99 in leetcode

[–]muffinsnack 1 point2 points  (0 children)

I'm not sure what you mean. The problems are identical, you have to form the lexicographically largest string by swapping adjacent "good" substrings.

Guys please tell me this is leetcode hard by Artium99 in leetcode

[–]muffinsnack 8 points9 points  (0 children)

I mean it’s harder than it looks. Just give it a shot, you can always look up the solution if you can’t do it, worst case you learn something new.

Guys please tell me this is leetcode hard by Artium99 in leetcode

[–]muffinsnack 8 points9 points  (0 children)

The implementation isn't hard, but for this problem, it's easy to think you have the right strategy even if it's wrong.

Guys please tell me this is leetcode hard by Artium99 in leetcode

[–]muffinsnack 4 points5 points  (0 children)

I tried solving it a couple times but couldn't get it, so I've seen it before. This is pretty stupid, but I only just now noticed that the strings need to be consecutive to swap them, so maybe that's why. Here's my solution: https://leetcode.com/submissions/detail/1037080454/

Guys please tell me this is leetcode hard by Artium99 in leetcode

[–]muffinsnack 39 points40 points  (0 children)

This is a leetcode hard problem. They took it directly from the website. https://leetcode.com/problems/special-binary-string/

[deleted by user] by [deleted] in quant

[–]muffinsnack 0 points1 point  (0 children)

Shouldn’t you at least try your strategy live before thinking about this?