Salesforce visited our campus (MNIT Jaipur) in the first week of September 2020 offering a 2 months summer internship which will take place in May and June 2021.

**Coding Round (75 minutes) HackerRank:**

- Given an array of integers, replace every number with the nearest right number whose frequency is greater than it in the array, if no such number exists replace it with -1. Next Greater Frequency element
- Find the size of the largest island in a 2-D matrix. It is similar to the below question with a little variation. Find the number of islands
- This question began with the explanation of the definition of tensors(there’s no problem if you don’t know about tensors at all) and they gave two 3-D matrices as input both with dimensions N x N x N and asked to multiply the top 2 axes of A with bottom 2 axes of B and output them in the form of N x N 2-D matrix.
**E.g:**Let there be two 3-D matrices of dimension 2 x 2 x 2.

A={ { {1,2},{3,4} }, { {1,2},{3,4} } } B= { { {1,2},{3,4} }, { {1,2},{3,4} } } Then the top two axes and bottom 2 axes of A and B can be represented in the form of 2-D matrices A' and B' as A'={{1,2,3,4} , {1,2,3,4}} B'={{1,2},{3,4},{1,2},{3,4}} now multiplying these two matrix will give output as Answer: {{22,32},{22,32}}

I was able to solve all the questions in 35 minutes which worked as a plus point for me in the interviews.

Out of around 100 students, 14 were shortlisted for the next round.

All the rounds from here onwards were held on Google Meet and Codepair and there was a single interviewer in each round.

**Technical Interview 1 (45 minutes):**

- Find next greater number with the same set of digits.

First I gave him an O(n*log(n)) approach using merge sort then he asked me to optimize it to O(n), so I used counting sort instead of merge sort then he asked me about radix sort and it’s time complexity. - Rearrange characters in a string such that no two adjacents are the same.

The interviewer was really helpful, and he gave some hints which I caught and gave him the correct answer.

After this round 10 out of 14 students got selected for the next round.

**Technical Interview 2 (50 minutes):**First, the interviewer made me comfortable by asking about the previous interview round and the coding round, and he also looked at my time and my solution in the coding round.

- He began with OOPS and asked me how can I use the concept of OOPS in my college to maintain interdependencies between different branches in my college therefore I explained him some methods with the help of the use of inheritance and friend function then I explained him about that in detail, and he looked quite satisfied.
- He asked me to write an algorithm to remove all the transitive relations from a hashmap where the key was a string and the mapped value is an array of strings.
**E.g:**Let the map key-value pairs be like this.

A->B,C,D,E B->F,G G->H S->T So the final content after removal of all the transitive relations in the hashmap will be: A->B,F,G,C,H,D,E S->T I used recursive DFS to solve this and he was satisfied with my answer.

- He asked me to write an algorithm for evaluating mathematical expressions given in the form of a string consisting of basic arithmetic operators +, -, *, and /.

I gave him an algorithm using parse tree and leftmost derivation then he asked me to expand my algorithm for special functions like log, sqrt, and pow so I expanded it using a hashmap to store the special keywords, he was satisfied by my approach. - He asked me to implement a cache of a given size.

The interviewer was really helpful and asked me to relax whenever he felt I was getting nervous.

After this round 5 out of 10 students were selected for the next round.

**HR Interview (45 minutes): **The interviewer began by asking me about my day today and about all the subjects I have studied in my college and which were my favorites.

He then asked me about what do I expect from the company for myself, and he also talked about my role in the previous college club I was part of. After that, he asked about my projects, I explained the project and the technologies used in detail for about 10 minutes. Then he asked me some questions on OOPS about Function overloading, Function overriding, Function Hiding, Virtual functions, and Inheritance in detail.

After that, he asked me about the use of pointers in C and C++. He also asked me about the data structures I have worked with and then asked me to implement a stack using queue. Then he gave me a situation that if I am the head of a team, and we have a deadline to complete a task and one of my team members will have to leave due to some problem, then how will I handle this situation. After this, he asked me if I have any questions to ask, so I asked him a couple of questions about my role in the company and the technologies I will work on if I get selected as an intern.

After this round, 3 students were selected and given an offer of internship and luckily, I was one of them.