Infosys is one of the major recruiters in the country. Since 2 years HackWithInfy has become one of the premier coding competitions conducted by Infosys. So here I am going to discuss my experience of HackwithInfy 2019. I applied for HackWithInfy through my college VIT Vellore’s training and placement cell.
It was held on 1st July 2019 on the HackerRank coding platform. It is merely an individual online coding challenge. It consisted of 3 coding questions that are different for each student to be solved in 3 hours. There will be plagiarism check and the final scores will depend on the number of test cases your code passes successfully.
I can exactly remember only one of the three questions word by word but I will put the gist of the other 2 questions for you
Question number 1
Given an array of n elements and a number m, we need to find all distinct pairs existing in the array whose pair sum is divisible by the given number m and then print the total number of such pairs. Distinct pairs means (1, 2) and (2, 1) are the same. Here I was able to pass half of the total cases and the rest cases did not pass due to exceeding the given time complexity constraint.
Question number 2
A string manipulation question. I managed to pass 2 out of 13 cases here.
Question number 3
It was a problem based on arrays. I managed to pass 8 out of 13 test cases.
Overall if you have moderate coding skills you are good to sail through this round. After 2 weeks I was among the 260 odd students from VIT Vellore and Chennai campus to be selected for round 2 of HackWithInfy 2019.
It was held on 14th July 2019. It was an online coding round consisting of 3 questions on the HackerRank platform with web camera access for the administrator. Just like round 1, every student got a different set of questions. The questions were of moderate to high difficulty. I managed to solve 2 questions completely and pass 2 test cases out of the available test cases in the third question. The questions were framed smartly and you have to just arrive at the gist of the question. So I would give you the gist of the questions.
Question Number 1
Given an array of n numbers find the largest difference in the starting and ending indexes of the elements of the all possible strictly decreasing sub-sequences in the array. Input: 21, 13, 18, 10, 7, 3, 1 Output : 4 Here for element 1 the decreasing subsequence can be mapped till 18.It is 18, 10, 7, 3, 1.Similarly, for 3 it can be mapped till 18 which is 18, 10, 7, 3. For 7 it can be mapped till 18 which is 18, 10, 7. For 10 it can be mapped till 18 which is 18, 10. For 18 there is no continuous decreasing subsequence. For 13 it is 21, 13. The largest difference in indexes is at index 2 and index 6 that is 4. This question can be done using Two pointer method. We can keep track of indices of contiguous subsequence just by checking next array element. store the difference in a variable max and check it after each iteration. You just have to find the longest increasing contiguous subsequence from the backside of the array and report the difference in the index of starting and ending elements. Complexity of the algorithm will be O(n). Input: 1, 18, 17, 14, 15, 32, 16 Output: 2
Question number 2
There are n people in the party. Each person is wearing T-shirts with numbers written on the T-shirts. The numbers on the T-shirts can be unique or the same. In three turns 3 people leave the party one at a time. You are provided with the people remaining in the party after every turn. You need to print the T-shirt number of people who left the party in the order they left. I used four maps in total one for initial array plus three one each for each turn arrays with T-shirt number as key and its frequency as value. I then compared the initial map with the first turn map to find the first missing element. Similarly, I then compared the first turn map with the second turn map to get the second missing element. Finally, I compared the second and third turn map to get the third missing element. Finally, I printed all the missing elements after storing it in a variable. I managed to pass all the given test cases.
Input:- Initial :- 11, 5, 1, 2, 7, 3, 1 After Turn 1 :- 11, 5, 2, 7, 3, 1 After Turn 2:- 5, 2, 7, 3, 1 After turn 3:- 5, 7, 3, 1 Output : 1, 11, 2 We can observe that one of the two 1's is missing after turn 1, similarly, 11 is missing after turn 2 and finally, 2 is missing after turn 3. So the output is 1, 11, 2. Input:- Initial :- 21, 15, 12, 11, 6, 5, 7 After Turn 1 :- 21, 15, 12, 6, 5, 7 After Turn 2:- 15, 12, 6, 5, 7 After turn 3:- 15, 6, 5, 7 Output : 11, 21, 12
Question number 3
I don’t exactly remember the question but it was based on prime numbers. I managed to pass 2 test cases out of the given total test cases.
The result was announced on 31st July 2019 and I was lucky few to get the Pre-placement interview for Power Programmer Role. In my college, only 9 were called for Power Programmer Interview while 91 were called for System Engineer Role.
It was a skype interview where the interviewer was himself a power programmer sitting at the Infosys office. First of all, he asked me to introduce myself. Then he asked me to explain basic OOPS concepts which I did well. Then he posted a coding question in the skype chatbox.
Given a file consisting of billions of characters. Read the file and for each chunk of 6 unique characters in the file map the string of all possible 6 letter chunks of unique characters to a unique value. Print the entire output.
I did not know file handling so, I tried to solve the question with the map. However, my code did not produce the right output.
Later he asked me questions about the kind of technologies I know and about my projects.
3 out of 6 were selected for HR round and I was not one of them. All 3 selected for HR round were given the job.
I got the opportunity to sit for the SES(System Engineer Specialist) role thereafter. I will share the experience of SES interview in the next post.
I would like to thank GeeksforGeeks without which I could not learn to code at all.