This is another interesting coding problem which is based on binary tree and like many other binary tree algorithms, you can use recursion to print all leaf nodes of a binary tree in Java. Since the tree is a recursive data structure, you can apply the same algorithm to the left and right subtree. A leaf node is the one whose left and right child nodes are null. So you can print all leaf nodes by traversing the tree, checking if the left and right nodes are null and then printing that leaf node. The logic is very much similar to post order traversal but instead of just printing node, we first check if both left and right children are null or not. It is also one of the frequently asked coding questions. Since the binary tree is an essential part of Data structures and algorithms, you can expect a couple of questions on binary trees and BST e.g. whether a given tree is binary search tree or not? This one is rather simple but it can be tricky if interviewer also asks you to solve this problem without recursion, as discussed here.
The map-reduce concept is one of the powerful concept in computer programming which utilizes the power of distributed and parallel processing to solve a big and heavy problems in quick time. From Java 8 onwards, Java also got this powerful feature from functional programming world. Many of the services provided by internet e.g. Google Search are based on the concept of the map and reduce. In map reduce a job is usually split into the input data-set into independent chunks which are processed by the map tasks in a completely parallel manner. The framework sorts the outputs of the maps, which are then inputted to the reduce tasks. For example, suppose you want to calculate the average age of all the people in a town, instead of counting sequentially you can first calculate their age using the map and then calculate the average using reduce.
The SQL (Structured Query Language) is one of the most important skills of a programmer. I would rate this skill similar to UNIX if you are a professional programmer because it doesn't matter whether you are Java, C++, or a .NET developer, you are bound to write SQL queries. Since a database is an integral part of any modern Java or Web application, Interviewer always preferred candidates with good SQL skills. Now, the big question comes, how a programmer can learn SQL? Does just knowing how to query a table is enough? If you know insert, update, delete, and select then are you a competent SQL programmer? What about indexes, query plans, triggers, views, stored procedures and other advanced SQL concepts? What about writing complex queries involving joins, subqueries, derived tables etc? Well, all those are very important to be a competent full stack developer.