oh my god I swear I’ve been in less extreme versions of this a few times lately. I can’t hide my annoyance and usually just tank the rest of it on purpose.
can anyone with better knowledge of the telecomm industry explain this behavior to me? my networking knowledge is a little meh
I live in a crummy neighborhood that only has spectrum as a provider. I have been topped at 200 mb/s with what I suspect is either a failing router or network problems in my neighborhood. My neighbors are also all having issues, so I suspect the network is having trouble. We have frequent 2-6 hour outages. Just reeks of infrastructure issues but I don’t know what could cause that.
Anyway, I get an email I’ve “become eligible” (first of all, what?) to get a 400 mb/s upgrade for an additional +$20/month. Sick. I was gonna do it but then realized they were gonna ship equipment next week and I might not be home - so, I decided to call them to delay shipment.
Well after a while I finally get to the right person for that and she wants to confirm the 400 mb upgrade and I was like wait, is there a faster one than that? And she immediately got weird like “this one is very good” and I was like “I understand - but is there a better one?” And she said well, yes, technically, but I have to check something first and frequently disappears every now and again, probably talking to a super.
She comes back and is still kind of hemming and hawing like “well, I think I can get you on that, but this is going to double your bill” and I was like “ok? can I do it then?” and then disappeared again and I’m on hold still.
why the fuck is a telecomm company downselling me right now? are the infra issues since the shift to work from home really placing that much strain on their networks? or is this just batshit incompetence?
they’re gonna sell me a 1 gb connection, it sounds like it’s either a beta thing or they are trying not to sell these.
In more lol leetcode news this perfectly sums up the “problem”
This solution took me 30 seconds:
Which would get me “rejected” or asked for a different solution by all interviewers. This one took me ~10 minutes.
and its fucking slower.
adding
if (hash[el] > Math.floor(nums.length / 2)) {
break;
}
in the update condition apparently makes it 1 ms faster than solution #1 
I prefer the second one - much more readable - you can reconstruct the question from the code.
You could also more easily incorporate additional conditions without having to completely refactor - ‘a majority element may not exist’ for example.
Are you supposed to consider such factors when answering these?
Probably not.
If I was interviewing and posed this I’d probably add the sort of code I was expecting … maybe even ask for both … 1. a well structured & readable function for a library and 2. the fastest by whatever means. That would show me quite a bit.
I remember years ago there was some competition for the smallest webpage with a fully functioning shopping cart and the winner came in at ~630 bytes. Wouldn’t want to maintain it though.
I work with a developer who would code something like this exactly to spec, and then have to COMPLETELY REDESIGN THE SYSTEM when it turns out that say, under certain conditions, we may want to send a user to a different page after logging in.
“Well nobody said that up front!” Dude, it’s a fucking website. How many websites have one and only one post-login landing page for all conditions, including deep-linking that requires login?
So the solution? Put the code that renders the header as logged in state in two places now instead of one, with the need to add it to any other potential landing page.
Actually I think he’s just not a very good developer. I eventually redesigned it so the header state wasn’t triggered by the freaking landing page. It wasn’t that hard. But to ask him beforehand it was going to be like moving the great pyramid.
He’s got one site where the header still shows the non-logged in state for like a half second after login. It drives me nuts. I feel like Big Bird with Snuffleupagus in that no one else on our team seems to notice it. But that site is 100% his baby. So I don’t bring it up.
I would never pay for an upgrade with the same provider if they can’t reliably deliver a lower speed. If your issues are between the exchange and your home(s) then a better modem/plan is unlikely to improve things. So be prepared to start complaining the moment your connection drops or doesn’t get the promised speeds.
Seems I always have at least 1 dev on my team where I feel like this too. Some guy that can’t be trusted with anything remotely complicated. The type where for about half their work it takes longer for me to explain to them how they fucked up than it would have for me to just do the job right myself in the first place.
It always feels like nobody else sees it. Though my team did just move from one group to another and it send like my new manager and the principal engineer we’re working closely with might be seeing it.
Yeah this guy is in a weird category that he knows react inside and out, and is rocksolid CSS. And he thinks like a lead and does look out for bigger issues than just his little piece.
But he seems to struggle with higher level stuff like the issue I described. It seems as soon as he comes up with a way to do something, he’s off and running. He never stops to think if the first solution that popped into his head is the cleanest, simplest or easiest way.
I can’t count the number of times he’s come up with some complicated solution that’s going to take weeks to implement and add a whole new layer of complexity to the codebase, and I’m like what if we just copy the file and have a tiny bit of redundancy to avoid a new layer of abstraction?
He thought that react with hooks (7 I think) would break all the old-style react components, so we’d have to refactor hundreds of components before we could upgrade. I was like dude I really don’t think they’d do that. So I just tried it, and lo and behold, the old components still worked fine. Months of work saved.
I almost feel like part of it is because we work for a university, and having stuff to do = job security. We don’t have the strongest incentive structure to get things done quickly or simply.
speed is not the issue. I consistently get far more than the 200 mb/s advertised. it’s the outages. that isn’t likely to get better or worse with a 1gb connection so I’d rather just have that.
also suzzer i feel your pain every time anyone asks my principal for a minor change it triggers an entire friggin refactor and he seemingly bristles every time i try to make it a bit more modular, or predict a future thing it’ll need.
I suspect the second snippet will run faster if you use a Map rather than an object. I think the numeric values have to be converted to strings to be used as keys in a regular object.
Just tried this and same approximate runtime. But leetcode is not consistent at all with these so who cares I guess.
Imo view leetcode & co as algorithmic puzzles, not as coding tasks. Your goal is NOT to quickly get a solution that works perfectly fine for 99% of realistic use cases. For practical purposes your first solution is fine and probably better. But the implied goal is to solve that algo puzzle and find the most efficient way to handle enormous problem instances. The interviewers check if you found some O(n) solution and sorting simply doesn’t qualify.
Ideally these coding challenge sites would put more thought into the design of their problems and test cases, so they could reliably fail submissions that don’t meet the complexity requirements. That’s harder to design and/or you’d have to run much larger problem instances (ie, higher server costs). Especially for those “easy” problem types, it’s hard to test via runtime. Meh
Just playing around a bit, codewars.com seems to be doing a better job in that regard, at least for harder problems.
After spending some time looking through the source code for some well respected libraries, I’ve come to the conclusion that good code looks really boring.
I’ve also found out that it’s hard to write really boring looking code.
I think the “easy” problems are mainly just making sure that you understand the runtime complexity of various data structures and general algorithms. In your example you are essentially supposed to see that this this is easily solvable in O(n) via a HashMap and you should therefore dismiss any kind of O(n log n) sorting based solution. That’s the entire point really.
Some medium/hard problems are really fun to figure out, that’s if you like solving puzzles anyway. And you need to do plenty of clever “tricks” to get there, you are probably just bored out of your mind grinding the basics tbh.
Good luck with your interview! 
I have interview with a local ecommerce company that’s super stoked on me because I come from a larger company - I don’t know what they’re all excited about, I think we just copy what the big guys are doing anyway.
numbers they’re throwing at me already are nearly 2x my salary, it’s a cool website, so I’m like uhh yea let’s do it. one of those roles where’s it’s like line by line a perfect description of what I’m already working on.
problem i learned last round of interviews is my programming is super rusty and slow, which they dont seem to care, this is more of a pure ops job - which is kind of a red flag, in my opinion, but if you can program at all in those environments it kinda makes you the defacto “guy.”
GL - MS is one of the few big techs left that I’d feel morally okay working for. Job satisfaction always seems high there if glassdoor can be trusted.
a big lesson I learned in the last 3 years though is these big corporate environments seem to be absolutely covered in red tape at every turn. stuff like - a task that takes actually 15 minutes can drag into weeks because you need to figure out how to get access to the thing you need and then jump through all those hoops to get it, etc. I don’t think it’s for me, I hate that crap


