This is the transcript of the mock interview with Candidate DG (10years)

SDEGuru: Hello Good Evening! How are you? We can get started any time you are ready.
Candidate DG: Hello, Thank you for asking. I’m ready. Thanks for meeting!

SDEGuru: My pleasure. Let’s get started. Welcome to the IM interview. First let us talk a bit about your work experience, and then we will go on to a coding question. Does that work?

SDEGuru: Tell me about a project at ABC Inc that you delivered. What is your proudest accomplishment?
Candidate DG: The biggest project I worked on at ABC Inc was a conversion of an existing Desktop Application (PowerBuilder framework) into WPF (.NET).

SDEGuru: What was so challenging about it?
Candidate DG: This was a critical application that managed inventory, processes, authorization, enforced limits on certain chemicals/etc, as well as provided reports. It was challenging because it’s such a huge system, we had to deliver new .NET code that ran alongside existing legacy code in PowerBuilder.

SDEGuru: Urgh PowerBuilder!!
Candidate DG: This meant that we had to learn how to sometimes update PB code (okay so you are familiar, sorry to hear that :)) to enforce new rules that we were implementing in the new .NET pages/screens. I would say I’m proud of how attentive I was in talking to the product owners, listening to their needs, and understanding how it all tied into the overall system. While I was on the project, we did 2 releases to Production that didn’t cause problems.

SDEGuru: So, What is the language of choice for you?
Candidate DG: C#

SDEGuru: On a scale of 1-10 how do rate yourself in C#?
Candidate DG: Maybe 7 or 8

SDEGuru: What will it take to make it a 9? What are you missing?
Candidate DG: I need more practice with things like generic classes, asyc/await and Tasks. I know them but I feel I could be better. I know with generic classes you can say things like “T where T is class” and I don’t know what all the options are for this.

SDEGuru: Excellent. Let us dive into coding question. Are you familiar with Sudoku?
Sudoku is a logic-based, combinatorial number-placement puzzle. The objective is to fill a 9×9 grid with digits so that each column, each row, and each of the nine 3×3 sub-grids or sub-squares that compose the grid contains all of the digits from 1 to 9, no duplicates, no numbers missing.
Candidate DG: Yeah! I am familiar with it.

SDEGuru: Given a Sudoku matrix, can you validate if it is a valid solution?
Candidate DG: So I should validate if all the numbers are filled in, and I need to enforce the rules? I could do that.

SDEGuru: Pretend you are building a Sudoku validation service, that will validate if the given sudoku is a valid solution or not. You decide the input format and the response of the service.
Candidate DG: I think just a multi dimensional array where I am getting each row of the sudoku as an array.

SDEGuru: Data type of the elements?
Candidate DG: int [][]

SDEGuru: Method signature?
Candidate DG: public bool isMatrixValid(int [][] matrix)

SDEGuru: Moving on to the actual coding, what is your validation strategy?
Candidate DG: I need to know that the matrix is not null, and contains 9 sub-arrays, and each of those contains 9 integers, and each integer is between 1-9.

SDEGuru: Go on!
Candidate DG: I need to go through elements in sets of 3, so row 0, indexes 0-2, row 1 indexes 0-2, row 2 indexes 0-2
To validate the groups are unique. But possibly there would be a simpler way. Row/column is easy for the entire matrix.


Candidate DG: Do you have a matrix already? How is the input going to be?
SDEGuru: you said it will be int[][]. Assume matrix is available to you. I will provide some raw test data.

Candidate DG: Comment: I am going to hard code the extraction of the sub-matrix here. This is kind of gross but I’m going to put it here for now.
SDEGuru: Can you do this programmatically? Say nested for loops?

Candidate DG: Yes I see that now that I’m writing it out.

SDEGuru: Good call on moving the looping code inside the function.

Candidate DG: ValidateSubMatrix should check Numbers 1-9 should appear exactly once. Right?
SDEGuru: No duplicates, no number missing, all numbers from 1-9 should appear once and only once.

SDEGuru: BTW, what is the big O for your algorithm?
Candidate DG: O(n^2)?

SDEGuru: Tell me more about how you plan to accomplish this.
Candidate DG: I could do this sequentially searching. I don’t know if I should do something fancy like a Stack ?!?

SDEGuru: How does it improve the algorithm in terms of runtime complexity, if you use a Stack?
Candidate DG: It doesn’t help performance, just makes code easier maybe?

SDEGuru: This line: isValid = isValid && true;
What does this line accomplish? foo && true is always foo?

SDEGuru: Time check, 7 mins to go!
SDEGuru: Are you sure the algorithm is still n^2?

SDEGuru: And we are done!!! Post interview followup time

SDEGuru: So what do you think? How did you do?
Candidate DG: I felt fairly comfortable with it. I tend to program that way that I write, rethink, move around, etc.

SDEGuru: How hard was the question?
Candidate DG: Fairly easy question

SDEGuru: How close are you to the solution? The expectation in a real interview (in person or phone interview), will be be complete all the three validations, in working code.
Candidate DG: I almost have the sub-matrix validation. I need the entire row and entire column validation. I feel sub-matrix was harder so that’s why I started there.

SDEGuru: I think it was a wise choice. I would have nudged you towards the sub-matrix part anyways. On the whole I don’t think you were able to showcase your full potential.

SDEGuru: A few tips for you

  1. Ask more questions: You should be making and stating assumptions and getting to the method signature, test data etc much more quickly. In this case, I had to ask pointed questions to extract this information from you.
  2. Take the time to design: You were too quick to jump into coding. You should have taken a bit more time on designing your solution. Think before you code, otherwise, you may come across as a bit clueless.
    There are two extremes in terms of answering styles. Quick on the draw and eternal thinker. The sweet spot is somewhere in between and a bit on the quicker side. You made the rookie mistake of being quick on the draw. Try slowing your roll a bit.

Candidate DG: On the second tip, I can be both. I find that I am more effective when I start plopping down algorithms, because I will see a more efficient way or how I want to organize something faster than if I think a long time. Maybe I am too quick, yes

SDEGuru: If you do not spend appropriate time planning you are running the risk of appearing “lost” and you will be wasting a lot of time writing/correcting stuff down on white board.

SDEGuru: Another thing, are you sure about the stack solution?
Candidate DG: Stack might be too much memory for this I think. I don’t use them often but just envisioned doing the Pop() for some reason.
SDEGuru: I am not sure how a stack based solution will work. It looks like the wrong DS for this problem. Again, you seemed to have trusted your instincts and blurted out something that was not properly thought through. This makes you look really bad in terms of your grasp of DS fundamentals.

For this question, if you had picked any other DS like a Hashmap/hashset, bitvector or similar, they make a lot more sense.

SDEGuru: Thanks for your time!!

Verdict:  If this were a real interview, the candidate will most likely not make it to the next round. While there are some promising bits in the interview, a straight forward question like this should have yielded clean swift coding with a clear though process. Clearly the candidate is not prepared, and will struggle if they were to be brought on-site for an interview.