Java developer Interview Questions
java developer interview questions shared by candidates
Top Interview Questions
Given an array of pairs of numbers, simplify the numbers. The pairs represent ranges, and the result is a simplified version of these pairs. So [1,5],[3,7] should result in [1,7]. Sort the pairs by the left number, and loop through combining if they overlap. Make sure to check the results, as multiple pairs can combine together to form a big range. var x = [[6,5],[3,7],[6,2],[3,20]]//array of pair of numbers; //Function returns smaller of two values var smaller = function(n){ if (n[0] n[1]) { return n[0] } else {return n[1]} } //functions to sort array in ascending order var sort = function (a,b){ return a - b; } function simplifyRange(x,smaller,bigger){ var finalarray = []; var minarray = x.map(function(n){ return smaller(n); }); var maxarray = x.map(function(n){ return bigger(n); }); minarray = minarray.sort(sort); maxarray = maxarray.sort(sort); finalarray.push(minarray[0],maxarray[maxarray.length-1]) return finalarray } console.log(simplifyRange(x,smaller,bigger)); var x = [[6,5],[3,7],[6,2],[3,20]]//array of pair of numbers; //Function returns smaller of two values var smaller = function(n){ if (n[0] n[1]) { return n[0] } else {return n[1]} } //functions to sort array in ascending order var sort = function (a,b){ return a - b; } function simplifyRange(x,smaller,bigger){ var finalarray = []; var minarray = x.map(function(n){ return smaller(n); }); var maxarray = x.map(function(n){ return bigger(n); }); minarray = minarray.sort(sort); maxarray = maxarray.sort(sort); finalarray.push(minarray[0],maxarray[maxarray.length-1]) return finalarray } console.log(simplifyRange(x,smaller,bigger)); |
What is the white space character in the regular expressions in Java? |
What is a singleton? |
What are you top 3 weaknesses and your top strength? |
Are you willing to travel? |
Questions about core java, multithreading, collection, GC, j2ee, spring, hibernate, JMS, webservice,SQL and so on. Broad, but not to deep since its first round. |
Programming question about Stack. |
Typical Java technical questions. Like how to generate a deck of cards and then shuffle them. |
The interview question was about implementing a game: 4-connected disks game! |
-Tell me about a project that you are proud of. What challenges did you face while you were dealing with the project? |