Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
Helped me learn to code faster and "wing it" getting rough ideas into code as fast and loose as possible. I think my ability to think of and code entire methods quickly and effectively has vastly improved from this game.
Warning: I quit that shit like crack because all I wanted to do was play screeps like 17 hours per day.
jespersh757815dHmmm. Just thinking without googling, but sum all the numbers, divide by 3.
Then you know what you need the three parts should equal.
Then I'm not sure if you should just start putting numbers together until you hit the equal. It isn't a problem I've had before
Root7306215d@jespersh That would be correct about as often as winning a game of solitaire without any move planning. Decently often, but by no means guaranteed.
If the array was all integers, the chance would approach (and reach) 100% as the percentage of 1’s increased.
You could guarantee it by an exhaustive O(n^2) or worse approach, but that’s probably not what they want to see.
12bitfloat608415dI hate these stupid fucking interview questions. Let's not kid ourselfs, not a single human being can just randomly come up with a good solution for a problem like this out of the blue. They all have to study for hours on end so they can answer a question that's 100% irrelevant to any problem in the real world. What an unnecessary waste of time for everyone involved
I would do what @jespersh did and divide by three but then you’d have to find those numbers that sum to that value. I can only think of a brute force way. You can skip searching for the final third and take what’s left if the first two sets are found bc obviously that would sum to the required value. Impossible if the sum won’t divide by 3. You’d have to put the remainder somewhere.
I wouldn't be able to solve that on the fly. That's not how you measure programming skills anyways.
Kind of a dick question to ask if they only give you 15 mins per question.
Fast-Nop3227915dThere is no such code in general - see the array [1, 2, 3] as counter-example, or [1, 1, 1, 1, 1, 1, 42]. Even though it is divisible by 3, there are no such three sub-arrays with the same sums.
To get close to such a solution, I would:
1) sort the array in descending order
2) put the current number into the sub-array that has the lowest sum
3) fetch the next number.
Probably not guaranteed to be optimal, but feasible in O(N log N).
Actually I might’ve misunderstood the requirements. If you want to split it without changing indexes of values, then divide sum by three, then add up the numbers from the beginning until you get to the sum divided by three. Then add numbers starting from the end of the array until you get the sum divided by three. If you find the sum both ways without letting the pointer starting from the right go below the last index the left pointer stopped at, then all that’s left in between is numbers that add up to the same value (you already found 2/3 of the sum going from the start and end of the array) and you win
JustThat224815d"Please solve these two coding problems, in any language you want, in 30 minutes"
"So I'll be working alone on exciting challenges if I get hired?"
"Hahaha. No, you'll be part of a cross-functional team which will include a project manager, have daily stand-ups and short sprints and will always do pair programming."
"So this is a test of..."
"How much bullshit you can eat in a single sitting"
JustThat224815d@12bitfloat "They" will tell you they are only looking to see how you approach the problem to get an idea of your mindset, not whether you actually solve the challenge or not.
Maybe there is some validity to that.
Wonder if they would accept, "I'd do a quick search on StackOverfllow to get started..." :)
cb21975715dIf I'm not mistaken that would be the subset-sum problem, higher scaled ... or the 3-partition problem, whatever.
Solution is DP-based in 3 dimensions.
If you failed a Turing test, does that mean you aren't human ?
not a single human being can just randomly come up with a good solution for a problem like this out of the blue.
I used to be rather good at that sort of thing !
Not that it actually got me any bloody jobs mind you !
"No I'm sorry sir, but getting 100% right every question in half the time than anyone else has ever done, doesn't mean you are suitable for the job.."
Maybe it was my 'people' skills..
I'd pop into the room next door with all the other candidates and ask one of them for the answer. :-)
I'm reminded of a manager of a new department at a place I worked, who knew nothing about his task..
But next door, was a department that already did 100% what his new department was going to do.
So I advised him to go and ask them how to do everything and copy them..
For a year, he stumbled around on his own, and took no notice of any of my IT advice.
After a year, he went to that department, asked them what to do, and low and beyond, their advice matched my advice. :-)
But I wasn't offered a job in the new department, even though I was the first in with my application.
Everyone else after me who applied, got a job..
I'm just one of those types folk don't like.
"No we can't hire him, he knows too much, and is too helpful.."
skydhash13715dI've done the Turing application and everything went great. But I kinda lost the motivation for them as the only thing I wanted them to do was to get the contract and assign me to it (I don't even care about the percentage they get as long as I got a fair wage). But it was even more work than me closing my own freelance projects.