Salesforce interview experience Real time questions & tips from candidates to crack your interview

SDE - Intern

Salesforce
upvote
share-icon
3 rounds | 9 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 4 Months
Topics: Data Structures, Algorithms, System Design, Aptitude, OOPS
Tip
Tip

Tip 1 : Must do Previously asked Interview as well as Online Test Questions.
Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 3 : Do at-least 2 good projects and you must know every bit of them.

Application process
Where: Campus
Eligibility: Above 7 CGPA
Resume Tip
Resume tip

Tip 1 : Have at-least 2 good projects explained in short with all important points covered.
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects and experiences more.

Interview rounds

01
Round
Hard
Online Coding Test
Duration90 Minutes
Interview date18 Aug 2021
Coding problem2

1. Bursting Balloons

Moderate
40m average time
60% success
0/80
Asked in companies
QuikrSamsungOracle

You are given an array 'ARR' of N integers. Each integer represents the height of a balloon. So, there are N balloons lined up.

Your aim is to destroy all these balloons. Now, a balloon can only be destroyed if the player shoots its head. So, to do the needful, he/ she shoots an arrow from the left to the right side of the platform, from an arbitrary height he/she chooses. The arrow moves from left to right, at a chosen height ARR[i] until it finds a balloon. The moment when an arrow touches a balloon, the balloon gets destroyed and disappears and the arrow continues its way from left to right at a height decreased by 1. Therefore, if the arrow was moving at height ARR[i], after destroying the balloon it travels at height ARR[i]-1. The player wins this game if he destroys all the balloons in minimum arrows.

You have to return the minimum arrows required to complete the task.

Problem approach

Approach :

1 )We will use a map data structure that will store the height of fired arrows.

2) Start a loop from i = 0 to i = N - 1 and for the i’th balloon if the map contains the value ARR[i] then it
means this balloon will get hit by the previous arrow.
2.1) Therefore decrease the count of ARR[i] in the map and if it becomes 0 remove the key from the
map.
2.2) Increase the count of ARR[i]-1 in the map because there is an arrow at this height available.

3) If the map does not contain the ARR[i] then We will need to fire a new arrow to increase the count of
ARR[i] in the map.

4) Now at the end find the sum of all the arrows present in the map and return it.


TC : O(N)), where N is the number of balloons.
SC : O(N)

Try solving now

2. Rotting Oranges

Moderate
20m average time
78% success
0/80
Asked in companies
MicrosoftAmazonApple

You have been given a grid containing some oranges. Each cell of this grid has one of the three integers values:

  • Value 0 - representing an empty cell.
  • Value 1 - representing a fresh orange.
  • Value 2 - representing a rotten orange.
  • Every second, any fresh orange that is adjacent(4-directionally) to a rotten orange becomes rotten.

    Your task is to find out the minimum time after which no cell has a fresh orange. If it's impossible to rot all the fresh oranges then print -1.

    Note:
    1. The grid has 0-based indexing.
    2. A rotten orange can affect the adjacent oranges 4 directionally i.e. Up, Down, Left, Right.
    
    Problem approach

    Approach : I solved this problem using Multisource-BFS as I had solved questions similar to this while preparing for
    my interviews.

    Steps :

    1) Initialize ‘TIME’ to 0.

    2) Declare a Queue data structure and a 2D boolean array ‘VISITED’.

    3) Push all cells with rotten orange to the queue.

    4) Loop till queue is not empty
    4.1) Get the size of the current level/queue.
    4.2) Loop till the 'LEVEL_SIZE' is zero:
    i) Get the front cell of the queue.
    ii) Push all adjacent cells with fresh oranges to the queue.
    iii) Mark the cells visited which are pushed into the queue.
    4.3) Increment ‘TIME’ by 1.

    5) Iterate the grid again. If a fresh orange is still present, return -1.

    6) Return maximum of ‘TIME’ - 1 and 0.


    TC : O(N * M), where N and M are the numbers of rows and columns of the grid respectively.
    SC : O(N*M)

    Try solving now
    02
    Round
    Medium
    Video Call
    Duration60 Minutes
    Interview date18 Aug 2021
    Coding problem6

    This round had 2 coding questions - first one related to designing a custom stack and the second one was a simple problem related to Linked List. This was followed by some questions from OOPS.

    1. Design a stack that supports getMin() in O(1) time and O(1) extra space

    Moderate
    15m average time
    85% success
    0/80
    Asked in companies
    RazorpayFlipkartAdobe

    Create a stack data structure that allows operations such as push (adding an element), pop (removing the top element), top (retrieving the top element), and also provides a way to retrieve the minimum element in constant time.


    Implement the following public functions :

    1. push(data) :
    This function should take one argument of type integer. It pushes the element into the stack and returns nothing.
    
    2. pop() :
    It pops the element from the top of the stack and returns nothing.
    
    3. top() :
    It returns the element being kept at the top of the stack.
    
    4.  getMin() :
    It returns the smallest element present in the stack.
    
    Operations Performed on the Stack:
    Query-1(Denoted by an integer 1): Pushes integer data to the stack. (push function)
    
    Query-2(Denoted by an integer 2): Pops the data kept at the top of the stack. (pop function)
    
    Query-3(Denoted by an integer 3): Fetches and returns the data being kept at the top of the stack. (top function)
    
    Query-4(Denoted by an integer 4): Returns the smallest element present in the stack. (getMin() function)
    
    Problem approach

    Approach : 

    1) We can store the minimum element encountered at any point of time in a variable, say ‘MINELE’.

    2) To handle the case when the minimum element is removed, we would need to store the previous minimum element.

    3) This can be done by storing the value 2 * 'DATA' - ‘MINELE’ when a new minimum value is added to the stack.

    4) Now, when we need to push a number in the stack : 

    4.1) We first need to check if the stack is empty or not. 
    4.2) If the stack is empty, we simply push the integer in the stack and make the ‘MINELE’ as ‘DATA’. 
    4.3) Otherwise, if the data is greater than or equal to the top value of the stack, simply push the data into the stack. 
    4.4) Else, push 2 * 'DATA' - ‘MINELE’ in the stack and update the value of ‘MINELE’ as data.


    5) For ‘POP’ : 

    5.1) We need to check if the stack is empty. 
    5.2) If the stack is empty, we return ‘-1’. 
    5.3) Otherwise, if the top value of the stack is greater than or equal to the ‘MINELE’ of the stack, simply pop the top value of the stack, the minimum value here would remain the same. 
    5.4) Else, the top is the minimum element and hence we need to retrieve the previous minimum element in the stack. 
    5.5) So update the ‘MINELE’ = 2 * ‘MINELE’ - ‘TOP’.


    6) For ‘TOP’ : 

    6.1) We need to check if the stack is empty. 
    6.2) If the stack is empty, we return ‘-1’. 
    6.3) Otherwise, if the top value of the stack is greater than or equal to the ‘MINELE’ of the stack, simply return the top value of the stack. 
    6.4) Else we need to return the minimum value in the stack, ‘MINELE’.


    7) For ‘GETMIN’, we need to check if the stack is empty. If the stack is empty, we return ‘-1’. Otherwise, we return the minimum value in the stack, ‘MINELE’.

    8) For ‘ISEMPTY’, we just need to check if the stack is empty.



    TC : O(1)

    For push(): O(1)
    For pop(): O(1)
    For top(): O(1) 
    For getMin(): O(1)
    For isEmpty(): O(1) 


    SC : O(1)

    Try solving now

    2. Palindrome Linked List

    Easy
    20m average time
    90% success
    0/40
    Asked in companies
    CiscoMicrosoftAmazon

    You are given a singly Linked List of integers. Your task is to return true if the given singly linked list is a palindrome otherwise returns false.

    For example:
    The given linked list is 1 -> 2 -> 3 -> 2-> 1-> NULL.
    
    It is a palindrome linked list because the given linked list has the same order of elements when traversed forwards and backward​.
    
    Follow Up:
    Can you solve the problem in O(N) time complexity and O(1) space complexity iteratively?
    
    Problem approach

    Approach :

    1) Recursively traverse the entire linked list to get the last node as a rightmost node.

    2) When we return from the last recursion stack. We will be at the last node of the Linked List. Then the last node
    value is compared with the first node value of Linked List.

    3) In order to access the first node of Linked List, we create a global left pointer that points to the head of Linked List
    initially that will be available for every call of recursion and the right pointer which passes in the function parameter of
    recursion.

    4) Now, if the left and right pointer node value is matched then return true from the current recursion call. Then the
    recursion falls back to (n-2)th node, and then we need a reference to the 2nd node from head. So we advance the left
    pointer in the previous call to refer to the next node in the Linked List.

    5) If all the recursive calls are returning true, it means the given Linked List is a palindrome else it is not a palindrome.


    TC : O(N), where N = number of nodes in the linked list.
    SC : O(N)

    Try solving now

    3. OOPS Question

    What are some advantages of using OOPs?

    Problem approach

    1) OOPs is very helpful in solving very complex level of problems.
    2) Highly complex programs can be created, handled, and maintained easily using object-oriented programming.
    3) OOPs, promote code reuse, thereby reducing redundancy.
    4) OOPs also helps to hide the unnecessary details with the help of Data Abstraction.
    5) OOPs, are based on a bottom-up approach, unlike the Structural programming paradigm, which uses a top-down approach.
    6) Polymorphism offers a lot of flexibility in OOPs.

    4. OOPS Question

    What is Abstraction?

    Problem approach

    If you are a user, and you have a problem statement, you don't want to know how the components of the software work, or how it's made. You only want to know how the software solves your problem. Abstraction is the method of hiding unnecessary details from the necessary ones. It is one of the main features of OOPs. 
    For example, consider a car. You only need to know how to run a car, and not how the wires are connected inside it. This is obtained using Abstraction.

    5. OOPS Question

    What is the difference between overloading and overriding?

    Problem approach

    Overloading is a compile-time polymorphism feature in which an entity has multiple implementations with the same name. For example, Method overloading and Operator overloading.

    Whereas Overriding is a runtime polymorphism feature in which an entity has the same name, but its implementation changes during execution.

    6. OOPS Question

    What are access specifiers and what is their significance?

    Problem approach

    Access specifiers, as the name suggests, are a special type of keywords, which are used to control or specify the accessibility of entities like classes, methods, etc. Some of the access specifiers or access modifiers include “private”, “public”, etc. These access specifiers also play a very vital role in achieving Encapsulation - one of the major features of OOPs.

    03
    Round
    Easy
    HR Round
    Duration30 Minutes
    Interview date18 Aug 2021
    Coding problem1

    This was my last round and I hoped it to go good just like the other rounds. The interviewer was very straight to point
    and professional. The interview lasted for 30 minutes.

    1. Basic HR Question

    Why should we hire you ?

    Problem approach

    Tip 1 : The cross questioning can go intense some time, think before you speak.
    Tip 2 : Be open minded and answer whatever you are thinking, in these rounds I feel it is important to have opinion.
    Tip 3 : Context of questions can be switched, pay attention to the details. It is okay to ask questions in these round,
    like what are the projects currently the company is investing, which team you are mentoring. How all is the work
    environment etc.
    Tip 4 : Since everybody in the interview panel is from tech background, here too you can expect some technical
    questions. No coding in most of the cases but some discussions over the design can surely happen.

    Here's your problem of the day

    Solving this problem will increase your chance to get selected in this company

    Skill covered: Programming

    Which keyword is used for inheritance?

    Choose another skill to practice
    Similar interview experiences
    company logo
    SDE - Intern
    1 rounds | 3 problems
    Interviewed by Salesforce
    2237 views
    1 comments
    0 upvotes
    company logo
    SDE - Intern
    2 rounds | 2 problems
    Interviewed by Salesforce
    0 views
    0 comments
    0 upvotes
    company logo
    SDE - Intern
    2 rounds | 4 problems
    Interviewed by Salesforce
    935 views
    0 comments
    0 upvotes
    company logo
    SDE - Intern
    2 rounds | 3 problems
    Interviewed by Salesforce
    677 views
    0 comments
    0 upvotes
    Companies with similar interview experiences
    company logo
    SDE - Intern
    3 rounds | 6 problems
    Interviewed by Amazon
    14559 views
    4 comments
    0 upvotes
    company logo
    SDE - Intern
    4 rounds | 7 problems
    Interviewed by Microsoft
    14081 views
    1 comments
    0 upvotes
    company logo
    SDE - Intern
    2 rounds | 4 problems
    Interviewed by Amazon
    9631 views
    2 comments
    0 upvotes