(Lateral Hire; Experience: 4 Years; For Bangalore location)
HackerRank round; 2 problems; Time: 2 Hours (Java language):
1. Given a string containing parentheses and other characters and a number n, output the position (index) of the closing parenthesis corresponding to the nth opening parenthesis. In case the parentheses are unbalanced, output -1.
2. Given a string, output it’s compressed version. A compressed version of a string is another string with all the consecutive occurrences of characters replaced by the character followed by the number of the occurrences. For e.g., if the input string is: “aaabbacdddd”, then the output should be: “a3b2a1c1d4”.
Coderpad round; 2 problems; Time: 1 hour (Java):
1. Minimum Distance between words:
Given a document/text and two words (which occur in the document), find the minimum distance between the occurrences of these 2 words. Distance between 2 words in a text is defined as the number of characters separating/between these 2 words.
The greedy solution to this problem was already implemented but it contained several (logical or semantic) bugs. Because of these bugs a set of test cases was producing wrong output.
The first objective for me was to identify and correct all the bugs such that all the given test cases pass.
Second objective was to create more test cases to find out other bugs (if any) present in the code, and further to fix these bugs.
2. Only around 20 minutes were left for the second problem in my case so it was relatively simpler.
Given a 2D array of size N×2, wherein thw first column in each row contains the name of student and the second column contains the marks of this student in certain subject, we need to find out the name of the student with maximum average marks and the maximum average marks. There can be multiple rows for a student storing marks obtained in different subjects.
Telephonic round; Time: 45 Minutes:
The interviewer asked about my career history, the projects I have worked upon and the technologies I have used. He cross-questioned on many answers that I gave regarding my previous projects, extrapolated the underlying problems to create new, gave me different scenarios and asked what would I have done differently for the solution to work well in these new situations. Many scenarios involved upscaling of the problem input size, time constraints and implied the introduction of Multithreading. Unix shell and AWK was mentioned in my skill so he asked some questions in these too.
Rounds 4 to 8:
All face to face; Held in Bangalore office; took more than 5 hours (excluding break times). I don’t remember distinctly the questions asked in each round, so will list them all in random order:
1. Many questions were based on the Java language. Questions based on conceptual knowledge of Collections, hashCode() and equals() contract, String and wrapper class immutability, String pool, String interning, Multithreading, Overloading and overriding, Dynamic polymorphism, WeakReference, Exceptions, Static and instance fields, etc. were asked.
2. Questions in the SQL involving joins (self join), indexes (clustered/non-clustered), query writing, etc. were asked.
3. An aptitude question: Given a 4-digit number (say abcd, where a, b, c, d are the digits) such that abcd × 4 = dcba (reverse of the number). Find out abcd.
4. A programming logic question (Greedy approach): Input a number (say N), find out the number with same digits, just/immediately greater than N. For e.g., following are the outputs of the given inputs:
123 -> 132
1368 -> 1386
253986321 -> 256123389
8631 -> None
5. Implementation of an LRU (Least Recently Used) cache in Java. (This was asked in the last round).
6. Design Patterns related problems. Different ways of implementing Singleton design pattern, best way. Adapter design pattern, etc.
7. Design problems:
a) How would you implement the Google Chrome browsing history (back and forward navigation).
b) How would you store different family relationships digitally; What data structure would you use? What would you do different if it’s Facebook relationships between different users. How would you suggest new friends to existing users?
8. Comparison of different data structures (like hashtable, list, array) in terms of time and space complexities.
9. Object oriented programming concepts: Difference b/w encapsulation and abstraction, etc.
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.