Salesforce Internship Interview Experience | On Campus 2021
Salesforce came to our campus to hire interns. The questions asked in each round were as follows.
Coding Round – This round had 3 questions to be done in 90 minutes.
- An n*m grid of bulbs was given. Some were on (denoted by ‘O’) and some were off (denoted by ‘X’). When you toggle the state of a bulb, the state of the bulbs adjacent to it gets toggled too. Return the minimum number of toggles needed to switch all the bulbs off or -1 if it is not possible. Constraints on n, m were 18. I did the problem using BFS, where two states were connected if they were one toggle away. This passed 5 out of 6 test cases and gave one TLE.
- An array color was given where color[i] represented the color with which a pencil had to be colored. There was one paintbrush corresponding to every color and we had to wait b seconds before using the same brush again. Forgiven b and color find the minimum time it takes to color all the pencils. A basic greedy solution based on counting the times each color is required was enough to pass all the test cases. A number of pencils, number of distinct colors, and all were given to be less than 100.
- A target price was given. Two arrays having crust prices and toppings prices were given. The same topping could be used at most thrice. We had to create a pizza with the closest price to the target price possible. The price could be more than the target price as well. But if there is a draw we had to return the lower price. I iterated on the crust prices and found the closest value to the remaining amount via backtracking. This was enough to pass all the test cases. The number of crusts was less than 10 and the number of toppings was less than 18.
Students who were able to solve 2 problems were called up for interviews. 20 students were called for the interview.
First Interview: The interviewer first introduced himself and then asked me to introduce myself. This part was over within 5 minutes. Then he gave me the question. Before giving me the question, he told me that it is the approach that matters, we will discuss different approaches and compare them. The question was to generate all permutations of a given string that had no repeating characters. I immediately gave him an approach and wrote some pseudo-code. He then asked me to dry run on a small example which I did. He then presented an alternate approach, which we discussed upon. Then I told him why his approach was slightly better than my first approach and he was impressed. Then he asked me to implement his approach which I did. He ran the code and it worked first try.
He then proceeded on to ask some other questions. He asked me when would you use an abstract class and when would you use an interface. I gave him some generic differentiating points and he was satisfied. He then asked me whether I know about design patterns. I said I have worked with spring so I have heard about dependency injection but I am not an expert. The next question was about database indexes and I told him we haven’t covered the topic in college. He smiled and ended the interview.
In 20 minutes I was called for the next interview. 17 students were called for the second interview.
Second Interview: Similar intro stuff. This was solely a coding interview. He gave me two questions. The first one was given an array of sides, construct a triangle with the largest perimeter. This was pretty easy. I told him I would sort the array and start checking in groups of three from the last element. I told him we only need to check three consecutive elements. Since, A[i] <= A[i+1] <= A[i+2], the only inequality we need to satisfy is A[i]+A[i+1] > A[i+2], if this condition is satisfied, we should return immediately, if not there is no point of keeping A[i+2] as any element before A[i] will not help us getting a bigger sum. He was okay with this answer but asked me if I could do it in O(n). I couldn’t at first, but then he gave me a hint of using priority_queue. I couldn’t get the hint immediately but ended up getting what he wanted me to do. I said we could heapify the array in O(n) and then do the same thing with the top 3 elements. Practice problem link, Article link
Then we moved on to the next question. An array of characters is given which has to be considered as the natural ordering of the alphabets. After this return whether a given list of words is sorted or not. I said I would create an alternate list where the first character will be replaced with ‘a’, second with ‘b’ and so on. He acknowledged that I was on the right track but asked me to better my approach memory-wise. I took a minor hint and then overloaded the <= operator to compare strings on the basis of the given ordering. He was satisfied and the interview was over. Link to article
In an hour I was called for the HR round. 12 students were called for the HR interview.
Third Interview: This was a pretty chill round. The interviewer introduced himself and I did the same. He had my resume in front of him and asked me to explain an open-source contribution I had mentioned in my resume. I went in great depth and explained it for around 10 minutes. He didn’t ask any follow-up questions. Then he asked me about my projects. I explained both my projects to him and he was satisfied. Then he asked me what were the challenges we faced while making the projects. I had prepared for questions like these already so I was able to give a nice answer. Then he asked what is the difference between working alone and working in teams. I gave him a generic answer about team spirit and testing etc. Then he asked what was I expecting from the corporate world. Then he asked me to design a system like Flipkart. I listed some features and wrote some tables. I spoke on it for some 10 odd minutes and then told him I was not expecting a question on system design to be asked in an intern hiring interview. He said he just wanted to see how I took on a problem and obviously wasn’t expecting me to design Flipkart in 10 minutes. Then the round was over.
Results were declared the same day and 4 students including me were selected for the internship.
PS: If you aren’t super talented or super lucky or super hard working, you are bound to face some rejections. I myself was rejected by 4 companies (with 6 digit stipends) before getting into Salesforce. Have faith in yourself and your hard work. I know this is easier said than done but trust the process. You will eventually get what you deserve.