Software engineer Interview Questions | Glassdoor.com.hk

Software engineer Interview Questions

308

software engineer interview questions shared by candidates

Top Interview Questions

Sort: RelevancePopular Date

The problems are not hard.

3 Answers

But you may need well preparation.

o(nlogn) solution based on binary search below. An o(n) solution based on hashtable is also possible but consume o(n) memory. public static void main (String[] args) throws java.lang.Exception { Pair p = findPairBySum(15, new int[] {1,2,3,4,5,6,7,8,9,10}); System.out.println(p.x); System.out.println(p.y); } public static Pair findPairBySum(int sum, int[] sortedArr) { for (int i=0; i= 0) return new Pair(first, expected); } return null; } public static int getIndex(int num, int[] sortedArr, int startIndex, int endIndex) { if (startIndex > endIndex) return -1; int pos = startIndex + (endIndex - startIndex) / 2; int valAtMiddle = sortedArr[pos]; if (valAtMiddle == num) return pos; if (num < valAtMiddle) return getIndex(num, sortedArr, startIndex, pos-1); return getIndex(num, sortedArr, pos+1, endIndex); } public static class Pair { public int x; public int y; public Pair(int x, int y) { this.x = x; this.y = y; } }

Note that the array is sorted already. O(n) time with O(1) space is feasible.

What is your shortcomings?

3 Answers

Write down code to calculate Fibonacci in 2 ways - then asked to explain complexity.

2 Answers

Second round: Implement an expression evaluator for arithmetic expressions. Followed up by, how would I add operator precedence and variables.

2 Answers

number pair coding

3 Answers

One or more comments have been removed.
Please see our Community Guidelines or Terms of Service for more information.

String manipulation questions

2 Answers

React code test (home) - create a countdown timer animation 2 days is given

1 Answer

What are threads, deadlocks, and how to deal with those?

1 Answer

Self intro Many follow-up questions

1 Answer

Why do you want to change job?

1 Answer
110 of 308 Interview Questions