Write an algo which will return all pairs of integers from a given list of integers that satisfy the following equations: x + y = z, where x,y,z are all present in the given list. Optimize it to run in constant time.
Developer Interview Questions
271,143 developer interview questions shared by candidates
There was a two part question in Hackerrank with a medium difficulty level. The first part was a coding exercise and the second part was describing the complexities of the solution that was used.
The following function is stripping (removing) all the characters in string stripChars from the end of the string str? The function is incomplete. What code should be there in place of the comment? public static String stripEnd(final String str, final String stripChars) { if (str == null) return str; int end = str.length(); int INDEX_NOT_FOUND = -1; if(end == 0) return str; else if (stripChars.isEmpty()) { return str; } else { // ********************* // What's the code here? // ********************* } return str.substring(0, end); } while (end != 0 && str.indexOf(stripChars.charAt(end - 1)) == INDEX_NOT_FOUND) { end++; } while (end != 0 && str.indexOf(stripChars.charAt(end - 1)) != INDEX_NOT_FOUND) { end--; } while (end != 0 && stripChars.indexOf(str.charAt(end - 1)) != INDEX_NOT_FOUND) { end--; } while (end != 0 && stripChars.indexOf(str.charAt(end - 1)) == INDEX_NOT_FOUND) { end++; }
Why is iOS faster than Android
How long did it take for them to give feedback?
MVC default method call
reverse the array, linear search, binary search
If you were to implement string replace function in C++, how would you do that?
are you ready to work at different client locations
What is your experience in same field?
Viewing 941 - 950 interview questions