Programming

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 :man_shrugging: Just playing around a bit, codewars.com seems to be doing a better job in that regard, at least for harder problems.

1 Like

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.

1 Like

Yeah its starting to click for me a bit, clearly the “point” isn’t to do “tricks” to get there or even anything particularly clever its just to write out the same fucking for loops and hashmap and binary searches over and over really. The funny thing is people bother to put up shitty solutions in the forum, I don’t really get it, what’s the point? Whatever, its a grind and the end result is worth it… I think.

Microsoft interview today maybe I’ll kill it and be done. Over fucking teams and some VSCode screen sharing extension lol.

2 Likes

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! :slight_smile:

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

There’s also an O(1) space optimization (which I believe is explained in Cracking the Coding Interview). That optimization can then be generalized to finding up to k elements that appear at least n/k times in O(n) time and O(k) space.

1 Like

Glad to see Code Wars still doing well. I used to work with this guy, who’s one of the founders: jhoffner | Codewars

Didn’t go great, asked some async stuff I wasn’t quite prepared for so have to work on that. I got somewhere but not good enough I’m sure. Oh well back to the grind. No async on leetcode so have to go find that. Fun.

2 Likes

The former i.e. write functions/loops that are mixed with setTimeout to not fire all at once/fire next one on resolve etc I couldn’t quite remember how to set that up, wonderful. Oh well there’s always drinking heavily at 4pm instead.

1 Like

You could always work through fixing your game to get more comfortable with async stuff. That poor one node instance you’re working to death will thank you. :smiley:

1 Like

“When I download my table into csv, all of my colors dissappear”

“yes you can’t download colors they’re in the html”

“Well I need to make a feature request”

:roll_eyes:

3 Likes

We may all be out of jobs soon. Could have done promiseArray = urls.map() though.

But in all seriousness. This thing could be a pretty powerful tool to get started on stuff like this where you remember how to do it… but promises are weird and how did that work again?

Use the Star Wars API to get a list of all the planets in the Star Wars Universe. Note, the api is paginated, so you will need to pull multiple times to get all the planets.

Display all of those planets in a list on the front page of your app. You may choose to show all the planets, or paginate them for the UX experience.

Add a text input at the top of the page that allows a user to search the full list of planets. The filtering should NOT re-call any api calls.

When a user clicks on a planet, they should navigate to a new page that shows a list of the residents of the planet fetched from the Star Wars API.

When a user clicks on one of the residents, they should navigate to another page that shows the personal details of that resident.

Include a header with breadcrumbs. Something like All Planets / Planet Name / Resident Name. Each breadcrumb section should be clickable to navigate to the appropriate page.

Include a service file that contains all the api urls and gets. Your React components should not contain any url references.

Style up the application as you like. The whole thing doesn't need to be perfectly polished, but we do want to see that you can implement a UI design. Even though we aren't giving you a design to implement. 😆😆 Our advice would be to give the app a decent layout that makes sense and then pick one piece of UI and give it some love ❤. This could be the planet list items, the search input, or the individual residents.

Bonus Points

Every company does things a little differently. The closer you get to our stack the better we'll be able to assess how you work with it. So, extra credit if you use any of the following:

Mobx and Mobx State Tree for state management.

Sass for styling.

React Router for routing.

Optimizing

various features are as fast as possible.

Re-use of components

Worse or better than being stared at while trying to solve LC mediums?

I swear to god i’m seeing versions of this same problem everywhere. query some api that returns paginated results and we’re gonna put some annoying rate limit on it and see what you do.