Java developer Interview Questions | Glassdoor.ca

Find jobs for java developer

Java developer Interview Questions

412

java developer interview questions shared by candidates

Top Interview Questions

Sort: RelevancePopular Date

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].

3 Answers

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?

2 Answers

What is a singleton?

2 Answers

What are you top 3 weaknesses and your top strength?

2 Answers

Are you willing to travel?

2 Answers

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.

2 Answers

Programming question about Stack.

2 Answers

Typical Java technical questions. Like how to generate a deck of cards and then shuffle them.

2 Answers

The interview question was about implementing a game: 4-connected disks game!

1 Answer

-Tell me about a project that you are proud of. What challenges did you face while you were dealing with the project?

1 Answer
110 of 412 Interview Questions