Open Side Menu Go to the Top
Register
Interview  Test Questions Problems, Solutions, Links, Discussion Interview  Test Questions Problems, Solutions, Links, Discussion

10-01-2016 , 01:26 PM
I'm starting to think hackerrank is garbage. All the questions and answers seem to have been written by non english speakers. The "editorial" section which explains the solution is only available after you have found the solution and they're hardly coherent and often not the best answer.

For example the solution to the bribe problem posted by the guy who wrote it was to use some weird bubble sort,

Spoiler:
Code:
t = int(raw_input())
for _ in range(t):
    n = int(raw_input())
    arr = map(int, raw_input().split())
    org = range(n+1)
    pos = range(n+1)
    cnt = [0]*(n + 1)

    ans = 0
    invalid = 0
    for i in xrange(n - 1, -1, -1):
            if invalid:
                break
            oldp = pos[arr[i]] #Get position in original array
            newp = i + 1
            while oldp != newp:
                ans = ans + 1
                cnt[org[oldp + 1]] += 1
                if cnt[org[oldp + 1]] > 2:
                    invalid = 1
                    break
                org[oldp], org[oldp+1] = org[oldp+1], org[oldp]
                pos[org[oldp]] = oldp
                pos[org[oldp + 1]] = oldp+1
                oldp = oldp + 1
    if invalid:
        ans = "Too chaotic"
    print ans


exercism.io seems far superior but the problems aren't hard enough (though maybe more realistic for most job interviews that aren't for google/amazon etc).

Anyone use something other than hackerrank? Ideally like exercism where you can view everyones solutions so you don't have to google the problem and read some indian's programming blog to check if your approach was the best.
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
10-01-2016 , 01:49 PM
I've probably done like 10 or so of the medium/hard ones on http://www.codewars.com/ and thought they were pretty good.

I think project euler problems can be counted on to have the most vetting and have so many solutions that you will always see excellent ones that are shorter than yours.

There are so many of these sites nowadays though... I haven't tried anywhere close to all of them.
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
10-01-2016 , 02:03 PM
+1 to gaming mouse on codewars and projecteuler. ive done 27 eulers fwiw.

interviewcake is pretty good but boy do they love linked lists.
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
10-01-2016 , 02:20 PM
I am getting this a lot on codewars:

Code:
The server attempted to execute your code but there was an issue with the request. This should be a rare issue. Please try running your code again. If the issue persists, please contact us
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
10-01-2016 , 02:22 PM
In fact it seems to do this every time I try to submit my code.
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
10-01-2016 , 02:43 PM
Quote:
Originally Posted by gaming_mouse
I've probably done like 10 or so of the medium/hard ones on http://www.codewars.com/ and thought they were pretty good.

I think project euler problems can be counted on to have the most vetting and have so many solutions that you will always see excellent ones that are shorter than yours.

There are so many of these sites nowadays though... I haven't tried anywhere close to all of them.
I used to work with Jake Hoffner, one of the founders. Very smart guy. Glad to see people using it!
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
10-01-2016 , 02:46 PM
Quote:
Originally Posted by RustyBrooks
I am getting this a lot on codewars:

Code:
The server attempted to execute your code but there was an issue with the request. This should be a rare issue. Please try running your code again. If the issue persists, please contact us
Quote:
Originally Posted by RustyBrooks
In fact it seems to do this every time I try to submit my code.
I sent this to Jake on FB.
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
10-01-2016 , 05:51 PM
I go to hackerrank and i am totally lost, have no starting point. where do you go to actually learn how to do that stuff? like, i just want the text book that shows this is the question, this is the answer, this is how it is solved. this is what this does.

I am learning ruby-on-rails/css/html5/jquery right now.
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
10-01-2016 , 08:15 PM
Quote:
Originally Posted by OmgGlutten!
I am learning ruby-on-rails/css/html5/jquery right now.
go to exercism.io and download the ruby problems. They come with unit tests that sort of guide you to the solution. You can also submit non working solutions and then look over everyone else's answers to learn what works.

hackerrank is a site for elite indian programmers competing over h1b visa positions at amazon. I wouln't bother with it until you're learning algorithms and data structures.
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
10-02-2016 , 03:07 AM
Hmm never tried codewars. I have been doing codefights for a bit when I'm bored of leetcode. The codefights is still has a lot of bugs but I think it has great potential.

You can do quick match fights against similar ranked people and you race to solve coding problems. I recommend giving it a try especially if you are trying to break the monotony.
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
10-11-2016 , 03:02 AM
Got an invite for a hackerrank test from a high frequency trading firm. One of the questions was disguised as a subset-sum problem:

Given an array of numbers.. find the minimal number of elements such that the sum of those elements is between L and H, where L<= H.

So for example
[4,1,3,5] L = 7 H = 10 return 2
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
11-26-2016 , 03:00 PM
I came across an interesting problem. You are given a string of digits, '1145'. You need to find the number of possible string representations of this number given the following rules.

1 -> a
2 -> b
3 -> c
....
11 -> k
...
26 -> z

so for the input, '1145' you can map the first 1 to 'a' or you can take '11' as a single number that maps to 'k'.

ie

1145 -> aade, kde, ane

so the output would be 3
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
11-27-2016 , 05:24 AM
I think I did I have done that problem before. It's a DP problem and someone I know was asked this by facebook
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
11-27-2016 , 05:59 AM
Haven't had time to read this thread yet but I will add:
Buying the book cracking the coding interview had been by far the best ROI investment I have ever made in my life (both money invested and time invested)

Source: I am a dev at Microsoft
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
11-27-2016 , 07:44 AM
Quote:
Originally Posted by Bantam222
Haven't had time to read this thread yet but I will add:
Buying the book cracking the coding interview had been by far the best ROI investment I have ever made in my life (both money invested and time invested)

Source: I am a dev at Microsoft
Yes and practice putting the solutions on a white board.
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
12-01-2016 , 04:19 PM
Had an interesting question that stumped be pretty hard.

"What is one thing you think a Python developer should know."

You can replace Python with whatever other language you want.

It stumped me because I thought it was a little over judgmental. I've met all sort of programmers who don't know about some idea X that I'd figure they ought to know about, and that's okay, I suppose.

I said write function, but I guess writing properly semantic, non C-like code would have been a better minimum bar.
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
12-01-2016 , 09:40 PM
I can't decide if I hate that question or not. I have a lot of trouble with the "one thing" part, it's kind of like "what's your favorite movie" which I can't not even come close to answering. I've seen thousands of movies and I love hundreds. I doubt I could even make a top 10 without changing my mind 20 times and still wouldn't be satisfied with it.

Maybe an interesting counter question would be "what is a feature of python that developers should NOT use"
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
12-02-2016 , 12:14 PM
Quote:
Originally Posted by daveT
Had an interesting question that stumped be pretty hard.

"What is one thing you think a Python developer should know."

You can replace Python with whatever other language you want.

It stumped me because I thought it was a little over judgmental. I've met all sort of programmers who don't know about some idea X that I'd figure they ought to know about, and that's okay, I suppose.

I said write function, but I guess writing properly semantic, non C-like code would have been a better minimum bar.
Not a good question. First of all the lowest common denominator for anyone who refers to themselves as a Python developer is different than the lowest common denominator for a senior type developer. Second of all there is more than one thing. The question implies to me some sort of hierarchy stemming from one basic thing. It is a poor way to view competency in a language.
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
12-02-2016 , 05:15 PM
That's what I was thinking about as well. The way a person used Python as a Django developer, a scientist, or a DevOps is going to be very different. I wouldn't expect a Django developer to be a master of I/O and Pandas, but I'd expect other kinds of programmers to be fluent in these things. I almost said run a python script from the command line, but then I figured there would be people who could reasonably program Python using some IDE who would never know how to do that either.

I was also asked a similar question on SQL. I said you should know data integrity, since that is the precise reason for SQL to exist. All other knowledge is pretty worthless without that under control.

I don't think they liked either of my answers.
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
12-02-2016 , 06:56 PM
Quote:
Originally Posted by daveT
That's what I was thinking about as well. The way a person used Python as a Django developer, a scientist, or a DevOps is going to be very different. I wouldn't expect a Django developer to be a master of I/O and Pandas, but I'd expect other kinds of programmers to be fluent in these things. I almost said run a python script from the command line, but then I figured there would be people who could reasonably program Python using some IDE who would never know how to do that either.

I was also asked a similar question on SQL. I said you should know data integrity, since that is the precise reason for SQL to exist. All other knowledge is pretty worthless without that under control.

I don't think they liked either of my answers.
I think this is a good post.
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
12-02-2016 , 08:32 PM
Yeah, I think the best answer is basically what you put in that post.

In either case, it's probably best to first state what you're actually answering. E.g. to start with "well, an interesting language feature that people don't typically get exposed to when first learning it is generator functions". At least that way the interviewer knows how you interpreted that rather vague prompt.
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
12-02-2016 , 08:42 PM
I have to say I "learned" about generators early into python but I think it was a year minimum before I really understood them and then a year later I was still figuring out things I hadn't really understood about them. I'm not 100% confident I know everything about them.
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
12-03-2016 , 06:43 PM
For sure. Anything form the Standard Lib is a good candidate as well. I could argue all day that I'd never want to work next to developer who doesn't know what hmac is, but I know that is a futile exercise, and I could reasonably talk to people who don't know what it is, and don't even need to know what it is.

Generators is an interesting topic though. I've taken some tests where the requirement is use all generators. I can do them, but at some point, it feels over zealous, especially when those one-liners become 150 characters long.

And also, as we once both found out, there is a difference between 2 and 3 with generators. I don't know v2 flavors at all.
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
12-03-2016 , 06:50 PM
Quote:
Originally Posted by daveT
And also, as we once both found out, there is a difference between 2 and 3 with generators. I don't know v2 flavors at all.
And I don't know the 3 flavors at all either.

I actually think python slightly screwed up with generators, but I'm not sure. I've finally decided that when writing utility libraries, returning a generator could be considered hostile unless there's a really good reason for it, or the caller has a *really* clear way to know that's what they'll get.
Interview  Test Questions Problems, Solutions, Links, Discussion Quote
02-08-2017 , 03:41 PM
Maybe this doesnt apply to the actual use of this thread, but I have done a project for a company and we are going to do an hour long review of it. Obviously Im sure there will be lots of "I did it this way because I was thinking about X" and "Why did you not do this Y?" but any pointers on preparation or perhaps "gotchas" anyone can think of? Any angles to kind of review before hand?
Interview  Test Questions Problems, Solutions, Links, Discussion Quote

      
m