# ServiceNow Interview Experience for Associate Software Engineer (On-Campus)

• Difficulty Level : Medium
• Last Updated : 17 Aug, 2021

Round 1(Online Coding Round – Hackerrank Platform): This round consisted of 1 Coding question and 15 Multiple choice questions. This round lasted for 60 minutes. One cannot switch between tabs during the test. Also, Webcam snapshots will be taken periodically.

The Coding Question:

Hey geek! It's time to become a success story instead of reading them. Check out our most renowned DSA Self Paced Course, now at a student-friendly price and become industry ready. And if you are looking for a more complete interview preparation resource, check out Complete Interview Preparation Course that will prepare you for the SDE role of your dreams!

Feeling prepared enough for your interview? Test your skills with our Test Series that will help you prepare for top companies like Amazon, Microsoft, TCS, Wipro, Google and many more!

1. A financial analyst is responsible for a portfolio of profitable stocks represented in an array. Each item in the array represents the yearly profit of a corresponding stock. The analyst gathers all distinct pairs of stocks that reached the target profit. Distinct pairs are pairs that differ in at least one element. Given the array of profits, find the number of distinct pairs of stocks where the sum of each pair’s profits is exactly equal to the target sum.

Example:

stocksProfit = [5, 7, 9, 13, 11, 6, 6, 3, 3]
target = 12 profit's target
• There are 4 pairs of stocks that have the sum of their profits equal to the target 12. Note that because there are two instances of 3 in stocksProfit there are two pair matching (9, 3): stocksProfits indices 2 and 7, and indices 2 and 8, but only one can be included.
• There are 3 distinct pairs of stocks: (5, 7), (3, 9), and (6, 6) and the return value is 3.

Function Description:

Complete the function stockPairs in the editor below.

stocksPairs has the following parameter(s):

int stocksProfit[n]: an array of integers representing the stocks

profits

target: an integer representing the yearly target profit

Returns:

int: the total number of pairs determined

Constraints:

Solution:

There are several ways to solve this problem. One of the best ways is to use Hashing. Other ways include sorting and the two-pointers technique.

Round 2(Technical Interview 1 – 60 Mins):

• A link to Collab workspace was shared, where two or more people can write/see codes written by others.
• The following were the questions asked

A Small Coding snippet was given, find and correct mistakes.

unsigned int i = 0;
for(i = 100; i >= 0; i--) {
printf(“%d\n”, i);
}
• Given a linked list where the elements are not sorted, the task is to remove duplicates

Version 1: Without using Additional space (can compromise on Time Complexity)

Version 2: Additional space can be used and can create a new list

Version 3: Additional space can be used but do not create a new list

• Given a string of length N consisting of lower-case English alphabets, the task is to count the number of substrings in which the frequency of each character is exactly K.

Version 1: Brute-force on all Substrings –

Version 2: Optimise a little bit –

Version 3: Super optimized approach –   where  is the number of distinct characters present in the string – viz., 26

I also showed her why my approach will work, by telling her that this was the problem I improved on Geeksforgeeks earlier

• Discussion about one of my projects – If I were to extend my project, what feature would I implement?

I was able to solve all the problems with ease, the interviewer was quite impressed.

Round 3(Technical Interview 2 – 60 Mins):

• A link to Collab was shared, it contained all of my codes in the previous Technical Interview round.
• The following were the questions asked: Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order. A mapping of digits to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.

Input: digits = "23"
Output:
["ad","ae","af","bd","be","bf","cd","ce","cf"]
• Version 2: You are also provided with a list of words; your task is to find how many words will be present in the output generated above
• Follow up: Can you do it in  time, where N is the number  of words and M is the maximum of the length of words., given that the length of the string digits will not exceed 15
• Question 2: Lowest Common Ancestor of two nodes in a Tree

Version 1: LCA of two nodes in Binary Search Tree (using the property of BST)

Version 2: LCA of two nodes in Binary Tree (Using Recursion)

Version 3: LCA of two nodes in N-ary Tree (Single Query)

Version 4: LCA of two nodes in N-ary Tree (Multiple Queries) – Can be solved using Euler Tour + RMQ

• Discussion on 2 of my projects – the brief idea of why we did them, how we did them, the scope of the project etc.
• Do you have any questions?

I was able to solve all the problems and it was a very good experience. The Interviewer helped me when I was stuck solving Version – 1 of the Key-pad problem.

Round 4(HM Interview Round – 90 Minutes):

Basic HR Questions

• Did you ever feel uncomfortable?
• What do you do when you feel uncomfortable?
• How did you spend time during the pandemic?
• Did you take the Vaccine?
• What do you know about the Company?
• When did you enjoy the best in your college?
• Did you ever feel uncomfortable in college?
• What did you do then?
• How do you convince a class of 60 students to attend a session? (They’ll not listen to you, they already have 75% attendance, punishing will bring chaos – How will you convince them?)

Some Technical Stuff

• If you want to scale your project, what would you prefer, vertical scaling or horizontal scaling, or both?
• System Design-based questions – Functional requirements, UI design, database schemas, load balancing, etc.
• Do you have any questions?

Again, the interviewer was quite impressed, it was a very friendly and healthy conversation.

Some key takeaways:

• The Interviewer is always there to help you. Always ask questions/hints whenever you’re stuck. Make sure you understand the problem statement.
• Practice coding problems. Hackerrank, GeeksforGeeks, and Leetcode have a good collection of problems asked in Interviews.
• Do a good number of interesting Projects. Projects add great value to the Resume.
• Never talk about your weaknesses. Never give them a reason to reject you

Verdict: Selected for Associate Software Engineer Role

My Personal Notes arrow_drop_up