Cracking the Coding Interview with Author Gayle Laakmann McDowell

ABOUT THE AUTHOR

Lilly

Producer, Blogger, Television Host, Green building lover, Queen of the Forest. Pour yourself a drink, put on some lipstick, and pull yourself together.

( 31 )
  • bio kult

    "How would you write code to rotate a matrix" ….. "Same way i would write any other code" "With an IDE and a keyboard" Duh…… You also failed to comprehend the exact terms of the question….You're free to rotate it in any direction(s) you like according to the question, as a certain direction(s) was not specified…. So you failed on 2 counts… Or did i accidentally come to a remote viewing interview?

    Reply
  • Balasubramaniam Elayaperumal

    To tilt 90 degrees, this code also would works

    int[][] input ={{1,2,3,4,13},{5,6,7,8,14},{9,10,11,12,15}};
    // Assign row to column & column to row
    int[][] out = new int[input[0].length][input.length];
    for (int i = 0; i < input.length; i++) {
    for (int j = 0; j < input[i].length; j++) {
    out[j][out[0].length – (i+1)] = input[i][j];
    }
    }

    Reply
  • Mrinal Rai

    woh…?! she looks nothing like her pic at the back of the book..

    Reply
  • Abhideep Singh

    what if matrix was not square?

    Reply
  • Anthony Mcqueen

    Shes speaking Java according to her book its the language shes familiar and comfortable with.

    Reply
  • Vemuri Ramanujadasu

    Thanks giving for this… i hope.. i will crack the interviews 🙂

    Reply
  • Bullitt

    Solution:
    Search for an existing library and use this instead of solving already solved problems.

    Reply
  • Hans Wurst

    Have you measured/estimated the impact of your optimization? How did the runtime change? How did the memoryfootprint change? Did you ask which of both is more important?
    Then why did you optimize even though it was obviously error-prone?

    Sorry but you don't get the job…

    Reply
  • casey brinegar

    You don't need to know this shit lol

    Reply
  • Phil Tron

    Hope I never have to program something like this.

    Reply
  • Lokendra Rawat

    OMG its so Simple do they ask this kind of questions ??

    Reply
  • Jabari Dash

    This is how I would do it: I only tested it once. But typically. the following steps should work.

    1. Transpose matrix
    2. Flip matrix horizontally

    https://github.com/N02870941/discrete_and_continuous_algorithms/blob/master/include/algorithms/rotate_matrix.hpp#L8-L35

    /**
    * @brief Rotate a matrix 90 degrees clockwise
    * time: O(n^2)
    * space: O(1)
    * for an nxn matrix
    */
    template <typename T> void rotate_matrix_clockwise(std::vector< std::vector<T> >& matrix) {
    int n = matrix.size();
    T temp;

    // Row by row, column by column, left to right, top down indexing
    for (int i = 0; i < n; i++) {

    // Flip matrix along main diagonal (transpose)
    for (int j = i+1; j < n; j++) {
    temp = matrix[i][j];
    matrix[i][j] = matrix[j][i];
    matrix[j][i] = temp;
    }

    // Flip each row horizontally
    for (int j = 0; j < n/2; j++) {
    temp = matrix[i][j];
    matrix[i][j] = matrix[i][n-1-j];
    matrix[i][n-1-j] = temp;
    }
    }
    }

    Reply
  • Harshal Shah

    Did anyone get why she took layer =1?

    Reply
  • Ron Borneo

    I thought this was one of the hardest problems when I first read her interview book, now it's not too bad. Guess it just takes time.

    Reply
  • Natalie Euley

    I can make web applications in my sleep and do 3-D rendering with no problems. But I wouldn't have been able to do that

    Reply
  • Murmad Man

    She is 'hot'? Some of you need to get your fucking eyes checked

    Reply
  • abhi20

    Left handers are just sexier

    Reply
  • lnpilot

    How sad that we need to learn a completely different skillset for job interviews than the actual skillset needed to do the job.
    The hundreds of billions of dollars lost by engineers wasting their time on practicing crap like white board coding, which is never used in real life engineering!
    We have IDEs and compilers now, you know.

    Reply
  • KUMAR SATYAM

    she is not at all interested in explaining

    Reply
  • Red Piana

    Why doesn't she just rotate the whiteboard? That is much easier.

    Reply
  • deniz elli

    Tech hiring is broken, your book is a testament to broken things.

    Reply
  • Gabby Seligman

    THIS SHIT IS BORING

    Reply
  • Jimmy Fallon

    And for your next task…
    I want you to write code in assembly that will land be able to land a SpaceX rocket on a launch pad in the middle of the Atlantic ocean at night.
    You can use whatever color marker you like.

    Reply
  • Abhi shek

    all this to pay my student loan for computer science degree.. god damn.

    Reply
  • Charbel Sarkis

    Why does the minus 1 for last make sense. The loop never reaches that number

    Reply
  • Sagar M rao

    Sweeet!!!

    Reply
  • WAVEDUP

    I'm going to have to watch this video multiple times to grasp that solution. This makes me feel even more terrified about my interview later. Maybe my Masters in CS was a waste of time smh.

    Reply
  • Rationalist Faith

    The only accomplishment Gayle Lackman should proud of is single handedly turning interview questions into a mental-masturbation exercise. She forgets what's between her legs and how that's one of the only reasons she got hired. She couldn't even last a year in a company before she took the easy false prophethood route.

    People like her have tarnished the tech industry and reduced engineering to some fake acting role. Beware, her methods are lies and you won't last.

    Reply
  • Piotrek Pe

    uszy jak skrzat

    Reply
  • Daniel A.

    Ask questions. Ok, u mean the film Matrix? How you want rotate it? Ehhh

    Reply
  • Cristian S. Guedes

    So the first advise is "Ask questions"? Well, once I got interviewed by a company from Washington DC and the guy would not let me ask any questions. He answered rudely: "Come on! All the informations you need are already written in the PDF!"

    Reply

LEAVE A COMMENT

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>