Programming

You can also use Promise.any() for that, if on node 15 or higher.

In my situation - which is to say that I’m gambling for a living and have no clue whether it will keep providing - I’m pleased about the rise of full-remote work, because I think it’ll make companies more comfortable with hiring older employees. I’ve heard concerns before about older people fitting in with workplace culture, full-remote makes those concerns near obsolete.

https://twitter.com/soychotic/status/1520126831478951936

4 Likes

Grunch:

image

3 Likes

Why does VS Code sometimes forget the workspace and start up with all the editors closed? It is random and infuriating, and asking the internet is very not helpful.

I had my first ever technical interview Tuesday and just got the result back:

They didn’t offer me the job I interviewed for.

But they offered me a job a level up instead!

Time to go drink some bourbon…

21 Likes

Congratulations!

1 Like

Lol yellow hearts

1 Like

But not enough for anybody to tell me why VS Code randomly forgets all my open editors :(

Congrats!

How about a TR?

1 Like

Yeah congrats. I would love to get an idea of the questions

1 Like

You didn’t even say PC or Mac, but look at preferences → settings → window → restore windows and set to “all”. Pretty hard to diagnose “randomly forgets” though.

Yeah, I’ve tried everything obvious the internet suggested. I posted a very slightly more detailed version a few days ago, although “randomly forgets” is all I really have. I doubt it’s useful info and I’m probably never getting an answer anyway, but I use Windows/WSL.

Opening the folder I was working in always brings them back for me.

I’m still on good 'ol Sublime. It sucks, but it does everything I need, and I know all its quirks.

Could it be the way you’re opening or closing VS code? As long as I quit Sublime all at once with Ctrl-Q, or it crashes, I’m fine. But if I close my current project before quitting, or do some other things that I can’t remember right now, then I’m fucked when it reopens.

Probably, but I have another interview scheduled that could be a contender, so we’ll have to see. They also haven’t provided comp details yet, so…

Interview itself was weird–75% of the interview was behavior/unstructured Q&A. The coding questions were very easy. One was clearly supposed to be “the hard one,” and it was basically find the maxes of given-size sliding windows in an array.

1 Like

Did they want efficiency for that? I could do that in like one line of code but it wouldn’t be very efficient.

It’s very unclear what they wanted. I asked about validating inputs, and was brusquely told that they didn’t care about that. So I started coding something with a heap, got momentarily hung up on the fact that Python’s god-awful heap doesn’t let you delete things from the heap. Before I had a chance to work through that, he said he “might be willing to overlook it” if I could tell him the time complexity of removing an item from the heap. So I told him, while explaining how you would go about doing it with an array-based heap. Then he interrupted to point out that the array was an implementation detail, and what if the heap was, counterfactually, a tree. And then after I answered that, he said he was satisfied and ended the coding section even though we were less than halfway through the allotted time, so we spent the rest of the time chatting.

And then in response to one of my questions he offhandedly mentioned that he did about 20 interviews per person who got hired. He then went back to clarify that he meant 20 onsites, not just screening interviews.

Like I said, it was weird.

Python heap is so bad.

The problem is given a sequence of numbers, return a new sequence with the max of the previous K numbers at each index?

A heap is good, each item will get inserted and deleted at cost log N, so the total is N log N.

What if you only kept the last K elements around though? Then your cost would be N * (something in terms of K), which will be better when N >> K.

So you want a data structure that allows arbitrary delete and cheap max. How about a queue and a binary tree?

When the item ages out of the queue – beyond K from index – remove it from the tree. Insert, delete, and get max all cost log K. So the total cost is N log K.

Does this work? I don’t think you can do better because log K for sorting is cheap.