Coding Interview Ninja: 50 coding questions with Java solutions to practice for your coding interview.

Kindle Edition
119
English
N/A
N/A
27 Mar
Ekim Ouye
Getting your dream software engineering job could be a matter of how well you perform in your coding interview part. Perhaps it is the most important part of your interview process.

Your recruiter will recommend you to read again your university algorithms and data structures book to brush up on Computer Science fundamentals. And although this is necessary, it is not enough. The types of questions that you will find in an algorithms book are not designed to be solved under pressure in a short 45-minutes period. The best way to prepare yourself for the coding interview is to practice on similar questions to the ones that you will be asked to solve. This is the aim of this book; to present you some sample interview coding questions with a sample solution code.

If you are aiming at a software engineering job at one of the top companies, this book will definitely help you prepare for your coding interview. The questions included in this book can not be found in Cracking the Coding Interview.

Reviews (28)

A good list of typical technical questions

A typical interview for a software engineer includes a technical test. The strength of this book is that it provides typical questions one might be asked. It does not cover all the questions, of course, but the number of algorithms it covers is extensive. It also has some open ended questions without solutions, just to think about some architectural questions or general questions like "what are the major differences between Java and C++", or "what is the difference between HashMap and TreeMap." Some solutions have errors, however seeing the questions themselves was very useful. Note that in some of my interviews I was given a piece of code with a bug in it, and the test was to find what was wrong with the code. So you can use this book to practice that type of questions as well! What the book is missing is an index, if you wanted to look up some specific algorithm, for example, a binary search, there is no way to tell if the book covers it or where it is located. This book really should be revised to include an index of every algorithm it is included, otherwise it is very impractical to use. Ali Julia review

Just buy it!

A good set of questions and nice answers in Java. So worth the money! I recommended it to my wife today. update: I changed my review to 4 stars instead of 5 because I found a bug in the solution for question number 17. The direction is good only the map needs to be updated instead. I've modified the original solution and now it works. I'll leave my solution below: class Triple { int startTime, endTime, ramNeeded; public Triple(int startTime, int endTime, int ramNeeded) { this.startTime = startTime; this.endTime = endTime; this.ramNeeded = ramNeeded; } } private int getRamNeeded(List applications) { if (applications == null || applications.size() == 0) return Integer.MIN_VALUE; Map eventMap = new TreeMap<>(); for (Triple app : applications) { eventMap.put(app.startTime, (eventMap.get(app.startTime) != null ? eventMap.get(app.startTime) : 0) + app.ramNeeded); eventMap.put(app.endTime, (eventMap.get(app.endTime) != null ? eventMap.get(app.endTime) : 0) - app.ramNeeded); } int curRam = 0, maxRam = 0; for (Map.Entry entry : eventMap.entrySet()) { curRam += entry.getValue(); maxRam = Math.max(curRam, maxRam); System.out.println("At " + entry.getKey() + " the RAM need is " + curRam); } return maxRam; } @Test public void check() { List input = new ArrayList<>(); input.add(new Triple(2, 4, 1)); input.add(new Triple(3, 6, 2)); input.add(new Triple(3, 9, 3)); Assert.assertEquals(getRamNeeded(input), 6); } }

Good list of questions and answers but no detailed analysis/info regarding the solutions

PRO: good selection of questions and answers, some of which I have not seen in other coding interview books I've read. So adding this book to your collection is a good idea for potential question/problem coverage. CON: Solutions don't come with explanations unlike other books, this book is more like a list of questions & their answers. However, a good online researcher can easily find more detail regarding the specific solution by searching based on the question details or the solution. But it would have been nice if this info was already in the book.

Great book to prepare before the Interviews

The process of interview is really hard... As a candidate I was looking for real interview questions.. and this book provide 50 real interview questions. The truth is that you must be very lucky to success to all of your interviews by reading just this book. In my opinion, every candidate for a Software engineering job should cover the chapter 1,2,3,4,9,11 from "Cracking the coding Interview" and then try some latest interview questions. The cracking the coding interview will introduce you to the way of thinking and in some advanced problems. After that, this book will be great to continue your preparation. I cover 35 out of 50 problems and it really helped me. I feel more confidence now. It contains problems that are solved with small solutions.. just like the interview questions. I would recommend this book 100%. Personally, the day before the interview, I will have a quick look over my solutions of these questions. I have to mention that this book contains the coding question I was asked 3 months ago by an elite company.

Must be read

An absolute must read! Even if you plain programming in any other language the questions aborded in this book are mandatory absolute algorithm you need to have seen at least once in your life as a professional programmer.

Really useful to prepare for a coding interview

Really useful to prepare for a coding interview. Includes 50 actual interview questions with answers. I recommend trying to solve them before looking at the answers. A must read in preparation for an important interview. It definitely helped me.

Good and Pragmatic Book

Good question/answer pairs. I guess there are around 50 questions that will cover good portion of interview material.

It's a pretty good collection of real-word interview questions

It's a pretty good collection of real-word interview questions! I enjoyed practicing on the book's questions; the provided solutions are most of the times really easy to grasp. I recommend it to anyone looking for practice material for a software engineer position.

the Kindle formatting is nice.

Decent book and for the first time, the Kindle formatting is nice.

Five Stars

Great problems to review right before your interview.

A good list of typical technical questions

A typical interview for a software engineer includes a technical test. The strength of this book is that it provides typical questions one might be asked. It does not cover all the questions, of course, but the number of algorithms it covers is extensive. It also has some open ended questions without solutions, just to think about some architectural questions or general questions like "what are the major differences between Java and C++", or "what is the difference between HashMap and TreeMap." Some solutions have errors, however seeing the questions themselves was very useful. Note that in some of my interviews I was given a piece of code with a bug in it, and the test was to find what was wrong with the code. So you can use this book to practice that type of questions as well! What the book is missing is an index, if you wanted to look up some specific algorithm, for example, a binary search, there is no way to tell if the book covers it or where it is located. This book really should be revised to include an index of every algorithm it is included, otherwise it is very impractical to use. Ali Julia review

Just buy it!

A good set of questions and nice answers in Java. So worth the money! I recommended it to my wife today. update: I changed my review to 4 stars instead of 5 because I found a bug in the solution for question number 17. The direction is good only the map needs to be updated instead. I've modified the original solution and now it works. I'll leave my solution below: class Triple { int startTime, endTime, ramNeeded; public Triple(int startTime, int endTime, int ramNeeded) { this.startTime = startTime; this.endTime = endTime; this.ramNeeded = ramNeeded; } } private int getRamNeeded(List applications) { if (applications == null || applications.size() == 0) return Integer.MIN_VALUE; Map eventMap = new TreeMap<>(); for (Triple app : applications) { eventMap.put(app.startTime, (eventMap.get(app.startTime) != null ? eventMap.get(app.startTime) : 0) + app.ramNeeded); eventMap.put(app.endTime, (eventMap.get(app.endTime) != null ? eventMap.get(app.endTime) : 0) - app.ramNeeded); } int curRam = 0, maxRam = 0; for (Map.Entry entry : eventMap.entrySet()) { curRam += entry.getValue(); maxRam = Math.max(curRam, maxRam); System.out.println("At " + entry.getKey() + " the RAM need is " + curRam); } return maxRam; } @Test public void check() { List input = new ArrayList<>(); input.add(new Triple(2, 4, 1)); input.add(new Triple(3, 6, 2)); input.add(new Triple(3, 9, 3)); Assert.assertEquals(getRamNeeded(input), 6); } }

Good list of questions and answers but no detailed analysis/info regarding the solutions

PRO: good selection of questions and answers, some of which I have not seen in other coding interview books I've read. So adding this book to your collection is a good idea for potential question/problem coverage. CON: Solutions don't come with explanations unlike other books, this book is more like a list of questions & their answers. However, a good online researcher can easily find more detail regarding the specific solution by searching based on the question details or the solution. But it would have been nice if this info was already in the book.

Great book to prepare before the Interviews

The process of interview is really hard... As a candidate I was looking for real interview questions.. and this book provide 50 real interview questions. The truth is that you must be very lucky to success to all of your interviews by reading just this book. In my opinion, every candidate for a Software engineering job should cover the chapter 1,2,3,4,9,11 from "Cracking the coding Interview" and then try some latest interview questions. The cracking the coding interview will introduce you to the way of thinking and in some advanced problems. After that, this book will be great to continue your preparation. I cover 35 out of 50 problems and it really helped me. I feel more confidence now. It contains problems that are solved with small solutions.. just like the interview questions. I would recommend this book 100%. Personally, the day before the interview, I will have a quick look over my solutions of these questions. I have to mention that this book contains the coding question I was asked 3 months ago by an elite company.

Must be read

An absolute must read! Even if you plain programming in any other language the questions aborded in this book are mandatory absolute algorithm you need to have seen at least once in your life as a professional programmer.

Really useful to prepare for a coding interview

Really useful to prepare for a coding interview. Includes 50 actual interview questions with answers. I recommend trying to solve them before looking at the answers. A must read in preparation for an important interview. It definitely helped me.

Good and Pragmatic Book

Good question/answer pairs. I guess there are around 50 questions that will cover good portion of interview material.

It's a pretty good collection of real-word interview questions

It's a pretty good collection of real-word interview questions! I enjoyed practicing on the book's questions; the provided solutions are most of the times really easy to grasp. I recommend it to anyone looking for practice material for a software engineer position.

the Kindle formatting is nice.

Decent book and for the first time, the Kindle formatting is nice.

Five Stars

Great problems to review right before your interview.

Really helpful

Got a job offer thanks to this book. I was interviewing with big tech companies in US. This book has basic and advanced coding interview questions with well written solutions.

Really helpful book for my preparation of interview. I ...

Really helpful book for my preparation of interview. I would be appreciate if the code was online in a downloadable form thus the 4-star rating.

Good collection

Good collection of problems, however reader has to verify if solutions are accurate, as test cases are not included. Overall, very nice collection.

Solutions are wrong!

The problems themselves seem like pretty good problems on an interview. But what good is a book on coding questions if the solutions don't make sense? Some of the solutions are logically wrong - they don't solve the problem (Example - the tree solutions don't work for many common cases) Other solutions are needlessly complex (example: To find the power of a number without using math.Pow, the solution is no better than a much simpler solution) The author also gets pre and post order mixed up, having different interpretations in consecutive problems! And this isn't a rare problem either - almost half the questions I was looking at had nonsensical solutions. If I was a interviewer, I wouldn't hire this author.

solutions are wrong

some solutions are wrong

No explanations, some buggy code

There are no explanations given for the salutiens (which can be OK) but since some of them are wrong or sub-optimal, there is no way to check your understanding. This also degrades trust in the solutions. I gave two stars instead of just one because there are a lot of example questions.

A must read book!

The book is very well written and helped me to get prepared for my technical interview in UK. It contains 50 interview questions that are to be fully understood by candidates. I really recommend it!

Five Stars

a good collection of coding problems.

Trending Books