Oracle Gandhinagar Interview (3 Yrs Experienced)
All rounds Pen-paper coding.
1. Given a file, Print All words which end with “ing” with their frequency
Condition: No inbuilt string function like substr split contains allowed.
character by character need to take input, when space comes, check whether last 3 chars “ing”. If yes then from start to that index, add that word to hashmap(if new word), otherwise increase frequency of that word.
after space adjust start index and iterate.
at last when whole file input taken, iterate through Hashmap and print key and value.
2. Given a big string (contains numbers) and a divisor, Print all Subarray with 2 to 5 size which is exactly divided by divisor.
Ex: 1234804 and divisor 12,
From all these subarrays 12, 123, 1234, 12348, 23, 234, 2348, 23480, 34, 348, 3480, 34804, 48, 480, 4804, 80, 804, 04 those which are divided by 12, need to print those.
Overriding and Polymorphism conceptual questions.
1. You are given 100 normal coins and 1 faulty coin
Need to tell whether faulty has higher or lower weight using minimum weight comparisons.
I first give 3 answer and then explanation and then optimised using 2 comparisons we can do.
Discuss with interviewer. They will help if you speak and at some point of time you stuck.
3. Function to write whether mobile number fancy or not.
Only 1st 2 conditions are there.
Java version and New features Java 8 9
Hashmap and set basic
How we can create Thread 2 ways write code And Difference
Given a matrix, count maximum no. of consecutive 1’s.
Starting point can be anything. We can go left, right, top, down.
0 0 1 1
1 0 1 0
0 0 1 1
0 0 0 1
ans: 6(0, 3 -> 0, 2 -> 1, 2 -> 2, 2 -> 2, 3 -> 3, 3)
Cherry in the glass puzzle
4th round with Senior director
Que: Given 13-MAR-2019 and n=40 means after adding 40 days to input date, we have 22-APR-2019.
No inbuilt Date function allowed.
Need to consider all cases, leap year or not, Monthwise days mapping(1->31, 4->30 etc), MAR->3, APR-4 mapping, 3-> MAR, 5->MAY mapping.
After that told that HR Will call you.
After Rejected from 20 different companies, got selected.
NEVER QUIT. APNA TIME AAYEGA.
Thanks to GeeksforGeeks for help.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course. In case you are prepared, test your skills using TCS, Wipro, Amazon. Google , E-Litmus and Microsoft Test Serieses.