127 private links
I developed these programming exercises while working at 1010data. Each summer we’d put a batch of half a dozen or so interns through a week-long intensive K training program, including this set of puzzles, and then set them loose on the real codebase.
These problems vary in difficulty from trivial to moderately difficult (in non-escalating order), and are suitable for beginners or anyone wishing to brush a little rust off. A solution is provided for each problem in k3- click and hold on the gray area beneath each IO sample to reveal it. Most problems have at least one elegant solution, but many have multiple valid approaches- see how many ways you can satisfy the requirements!
101+ coding interview problems with detailed solutions, test cases, and program analysis
Calculating the mean of a list of numbers Consider the following problem:
You have a list of floating point numbers. No nasty tricks - these
aren’t NaN or Infinity, just normal “simple” floating point numbers.
Now: Calculate the mean (average). Can you do it?
It turns out this is a hard problem. It’s hard to get it even close to right. Lets see why.
Data structure and algorithms are core part of any Programming job interview. It doesn't matter whether you are a C++ developer, a Java developer or a Web developer working in JavaScript, Angular, React, or Query. As a computer science graduate, its expected from a programmer to have strong knowledge of both basic data structures e.g. array, linked list, binary tree, hash table, stack, queue and advanced data structures like the binary heap, trie, self-balanced tree, circular buffer etc. I have taken a lot of Java interviews for both junior and senior positions in the past, and I have been also involved in interviewing C++ developer. One difference which I have clearly noticed between a C++ and a Java developer is their understanding and command of Data structure and algorithms.
On average, a C or C++ developer showed a better understanding and application of data structure and their coding skill was also better than Java developers. This is not a coincidence though. As per my experience, there is a direct correlation between a programmer having a good command of the algorithm also happens to be a good developer and coder.
I firmly believe that interview teaches you a lot in very short time and that's why I am sharing some frequently asked Data structure and algorithm questions from various Java interviews.
If you are familiar with them than try to solve them by hand and if you do not then learn about them first, and then solve them. If you need to refresh your knowledge of data structure and algorithms then you can also take help from a good book our course like Data Structures and Algorithms: Deep Dive Using Java for quick reference.