
What happens when you type Google.com into the address box and press enter - PleaseHelpMe
https://github.com/alex/what-happens-when/blob/master/README.rst
======
mfrisbie
A spot of satire to go along with this:
[https://alwaystrend.in/articles/interview-question-what-
happ...](https://alwaystrend.in/articles/interview-question-what-happens-when-
you-visit-a-url-phased-out)

------
kuharich
Previous discussions:
[https://news.ycombinator.com/item?id=8902105](https://news.ycombinator.com/item?id=8902105),
[https://news.ycombinator.com/item?id=9189096](https://news.ycombinator.com/item?id=9189096)

------
dracodoc
It's lacking the biology part and physics part, and chemistry, and ....

Some of the sections are just out of context and become showing offs(like the
keyboard part. For a hardware position that is not enough, for a software
position that's non-relevant), which doesn't mean more sophisticated, just
different interest domains.

~~~
lucideer
Your comment sums it up well but I don't see what the problem with that is.
Expanding arbitrarily into different interest domains without any limits
(upper or lower) to detail seems exactly the point of this repo. Which seems
great.

~~~
dracodoc
That point (arbitrary domains) become less impressive for me when I knew
everybody can have some less known knowledge to others.

I found I often can learn from slickdeals discussion in various topics, which
is actually a good way to hear seasoned opinions.

------
bryanrasmussen
This is like that old comedic trope where someone says start at the beginning
and the respondent says 'Well, a long time ago the universe existed as a
single point that was infinitely small, infinitely hot, and infinitely
dense..' and the questioner has to spend a lot of time saying ok skip that,
okay skip that part...

on edit: typo fixed

------
Canada
I love this how oversimplified this is.

------
tomelders
What is the actual utility of this question?

~~~
roel_v
Before it was such a cliche, it was actually a great question. Open ended,
allowing you to gauge how a candidate deals with unknown problems; answers can
focus on any part of what happens, giving you an idea of where the candidate
has most experience; lots of opportunities to ask questions to go deeper; but
also lots op opportunities to say 'yeah let's just skip this part'.

As a candidate, I loved the creativity in it, and the chances it gives you to
show off knowing things that you don't necessarily _need_ to know to do a
certain job but will still make you better at it than others. Say, when you're
an (average) web dev, you don't need to know much about DNS. But pointing out
the difference between an A and an MX record shows you have deeper knowledge
than many, or at least that you've managed some systems before.

Look, I'll admit that I too have at some point asked people 'what's the
difference between an object and a class'. But that's such a shit question,
today I'd only do it after having asked some other questions they completely
bombed to check if they know anything at all, or after apologizing profusely
for the question and blaming it on 'standardized interviewing procedure' or
whatever.

I deal a lot with spatial information systems; here's my favorite question I
used to ask back when I interviewed people: consider a matrix A of dimensions
M x N. Assume that that matrix represents a height map, i.e. each value
represents the elevation at that location of a (discrete representation of) a
terrain. How would you go about filling this matrix to make it represent a
pyramid, i.e. the center cell having the highest value, linearly going down to
0 (or 1) at the border cells? Start by enumerating the assumptions you make,
pick the ones that make your solution simplest, then go from there describing
how you'd go about relaxing the constraints of your assumptions.

Then I'd draw a sample on a small 5x5 matrix.

I've had people who couldn't understand the problem no matter how hard I
tried; and then I had people who would insist on showing 5 different ways of
doing it complete with big O notation (in both cycles and memory) to
illustrate the trade offs.

Anyone else have any favorite interview questions they came up with themselves
that you think are a good representation of your field?

~~~
IIAOPSW
I assume my code knows (or can readily find) the value of M and N. The
max_height of the pyramid is ceil(M/2) + ceil(N/2). The height of every point
in the matrix can be readily calculated by taking its Manhattan Metric
distance from the center. The equation is max_height - (floor(abs(i-M/2)) +
floor(abs(j-N/2))). O(MN) operations are needed. The ceils and floors are
there to deal with the case that M or N is even. I did this in my head so
there may be off an off by one error which is easily remedied.

I forget terminology. Object is an instance of a class right?

Did I get the job?

~~~
SmallDeadGuy
Actually, if your M/2 isn't integer division (which I assume is the case from
your use of ceil around it first), your 5x5 pyramid would look like this:

    
    
        23443
        34554
        45665
        45665
        34554
    

Using max_height - (abs(i - floor(M/2)) + abs(j - floor(N/2))) would give the
properly-centered pyramid:

    
    
        23432
        34543
        45654
        34543
        23432
    

Your max height should really be just max(ceil(M/2), ceil(N/2)) for a height
of 3 going to 1 at the edges or floor(M/2) for 2 to 0. Using both Manhattan
distances gives you an octagon-base pyramid (approximated to the square shape)
when really you just want the max of both distances:

    
    
        max_height - max(abs(i - floor(M/2)), abs(j - floor(N/2)))
    

gives:

    
    
        11111
        12221
        12321
        12221
        11111
    

But this only works for square pyramids, using 3x5 you get:

    
    
        12221
        12321
        12221
    

If you want a rectangle pyramid, use min manhattan distance from edge (don't
need a max height then):

    
    
        1 + min(i, N-i-1, j, M-j-1)
    

gives:

    
    
        11111
        12221
        11111
    

or for a 7x10 grid:

    
    
        1111111111
        1222222221
        1233333321
        1234444321
        1233333321
        1222222221
        1111111111
    

Python 3 code for those who want to test themselves:

    
    
        N = 7
        M = 10
        for i in range(N):
            print("".join(str(1 + min(i,j,N-i-1,M-j-1)) for j in range(M)))

~~~
IIAOPSW
This is what I get for trying to work it out in my head and be the first
clever person to respond to OP.

I like your code. very elegant solution with mins and such.

