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

SDE - 1

ServiceNow
upvote
share-icon
4 rounds | 7 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 7 months
Topics: Computer Fundamentals, OOPS, DBMS, SQL, Puzzles, Programming, Data Structures and Algorithms.
Tip
Tip

Tip 1 : Focus on fundamentals and have crystal clear concepts on data structures and algorithms
Tip 2 : Practice programming as much as you can, at least 200 problems
Tip 3 : Have solid problem solving skills

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

Tip 1 : Add your technical achievements.
Tip 2 : Add your 2 major projects done.

Interview rounds

01
Round
Medium
Online Coding Interview
Duration90 minutes
Interview date5 Sep 2021
Coding problem2

Online round was of on MCQ's and 2 coding problems based on data structures and algorithms.

1. Pair Sum

Easy
15m average time
90% success
0/40
Asked in companies
SalesforceUberPayU

You are given an integer array 'ARR' of size 'N' and an integer 'S'. Your task is to return the list of all pairs of elements such that each sum of elements of each pair equals 'S'.

Note:

Each pair should be sorted i.e the first value should be less than or equals to the second value. 

Return the list of pairs sorted in non-decreasing order of their first value. In case if two pairs have the same first value, the pair with a smaller second value should come first.
Problem approach

The steps to solve the problem are as followed:

1. Initialize a variable, say countPairs, to store the count of distinct pairs of the array with sum K.
2. Sort the array in increasing order.
3. Initialize two variables, say i = 0, j = N – 1 as the index of left and right pointers to traverse the array.
4. Traverse the array and check for the following conditions: 
5. If arr[i] + arr[j] == K: Remove consecutive duplicate array elements and increment the countPairs by 1. Update i = i + 1 
and j = j – 1.
6. If arr[i] + arr[j] < K then update i = i + 1.
Otherwise, update j = j – 1.
7. Finally, print the value of countPairs.

Try solving now

2. Longest Palindromic Substring

Moderate
20m average time
80% success
0/80
Asked in companies
MicrosoftCIS - Cyber InfrastructureGartner

You are given a string 'str' of length 'N'.


Your task is to return the longest palindromic substring. If there are multiple strings, return any.


A substring is a contiguous segment of a string.


For example :
str = "ababc"

The longest palindromic substring of "ababc" is "aba", since "aba" is a palindrome and it is the longest substring of length 3 which is a palindrome. 

There is another palindromic substring of length 3 is "bab". Since starting index of "aba" is less than "bab", so "aba" is the answer.
Problem approach

The idea is to Fix a center and expand in both directions for longer palindromes and keep track of the longest palindrome seen so far.

The steps to solve this problem are as follows - 

1. Maintain a variable ‘ maxLength = 1 ‘ (for storing LPS length) and ‘ start =0 ‘ (for storing starting index of LPS ).
2. The idea is very simple, we will traverse through the entire string with i=0 to i<(length of string).
1. while traversing, initialize ‘low‘ and ‘high‘ pointer such that low= i-1 and high= i+1.
2. keep incrementing ‘high’ until str[high]==str[i] .
3. similarly keep decrementing ‘low’ until str[low]==str[i].
4. finally we will keep incrementing ‘high’ and decrementing ‘low’ until str[low]==str[high].
5. calculate length=high-low-1, if length > maxLength then maxLength = length and start = low+1 .
3. Print the LPS and return maxLength.

Try solving now
02
Round
Medium
Video Call
Duration60 minutes
Interview date8 Sep 2021
Coding problem2

 Coding easy and medium level problems were asked in this round.

1. Is Binary Heap Tree

Easy
10m average time
90% success
0/40
Asked in companies
AmazonServiceNowD.E.Shaw

You have been given a binary tree of integers.

Your task is to check if it is a binary heap tree or not.

Note:

A binary tree is a tree in which each parent node has at most two children. 

A binary heap tree has the following properties. 
1. It must be a complete binary tree. In the complete binary tree every level, except the last level, is completely filled and the last level is as far left as possible.

2. Every parent must be greater than its all children nodes.
For example:
Consider this binary tree:

binary_heap

Figure 1 is a complete binary tree because every level, except the last level, is completely filled and the last nodes are as far left as possible, and the level has 2 nodes both on the left side.

Figure 2 is not a complete binary tree because level 2 (level is 0 based) is not completely filled means the right child of the node (36) is missing.
There is another reason, in the last level, there can be one another node in between node (1) and node (14) to make the binary tree as far left as possible.
Note:
1. In the world of programming two types of binary heap tree possible:
   a. Min-heap - if all parents nodes are lesser than its children nodes.
   b. Max-heap - if all parents nodes greater than its children nodes, explained in the above figure-1.

2. In this problem binary heap tree is a binary max-heap tree.
Problem approach

The steps to solve the problem are as follows -

In the array representation of a binary tree, if the parent node is assigned an index of ‘i’ and left child gets assigned an index of ‘2*i + 1’ while the right child is assigned an index of ‘2*i + 2’. If we represent the above binary tree as an array with the respective indices assigned to the different nodes of the tree above from top to down and left to right.

Hence we proceed in the following manner in order to check if the binary tree is complete binary tree. 
1. Calculate the number of nodes (count) in the binary tree.
2. Start recursion of the binary tree from the root node of the binary tree with index (i) being set as 0 and the number of nodes in the binary (count).
3. If the current node under examination is NULL, then the tree is a complete binary tree. Return true.
4. If index (i) of the current node is greater than or equal to the number of nodes in the binary tree (count) i.e. (i>= count), then the tree is not a complete binary. Return false.
5. Recursively check the left and right sub-trees of the binary tree for same condition. For the left sub-tree use the index as (2*i + 1) while for the right sub-tree use the index as (2*i + 2).

Try solving now

2. House Robber III

Moderate
35m average time
65% success
0/80
Asked in companies
AdobeServiceNowWunderman Thompson Commerce

The ninja visits an amusement park but finds himself confused because he wants to ride the rides such that he gets maximum fun. The amusement park has only one entrance that is root.

Each ride has a fun number assigned to it and ninja wants to maximize this fun but there is a rule in the park that no one is allowed to ride two directly connected rides.

As the ninja is smart and good in programming because he did a course from coding ninja, he found immediately that park rides are connected like binary tree where the root is the root of the binary tree. Help the ninja to get the maximum fun this time.

Problem approach

Approach: DFS on Tree

* On each node, Recursively store what value it would have if you choose vs not choosing it. Store both values :)
* If you choose current node, then you will have to add child node's not_choose values.
* If you don't choose current node, then you can add maximum of child node's choose, not_choose values.

Try solving now
03
Round
Medium
Video Call
Duration60 minutes
Interview date8 Sep 2021
Coding problem2

Problem solving questions were asked.

1. Right View

Moderate
35m average time
65% success
0/80
Asked in companies
AdobeSAP LabsRazorpay

You have been given a Binary Tree of integers.

Your task is to print the Right view of it.

The right view of a Binary Tree is a set of nodes visible when the tree is viewed from the Right side and the nodes are printed from top to bottom order.

Problem approach

The steps to solve the problem are as follows - 
1. The problem can be solved using simple recursive traversal. 
2. We can keep track of level of a node by passing a parameter to all recursive calls. 
3. The idea is to keep track of maximum level also and traverse the tree in a manner that right subtree is visited before 
left subtree. 
4. Whenever we see a node whose level is more than maximum level so far, we print the node because this is the last node in its level.
5. And also note that we traverse the right subtree before left subtree.

Try solving now

2. Implement Trie

Hard
41m average time
0/120
Asked in companies
UberAmazonWalmart

Implement Trie Data Structure to support these operations:

insert(word) - To insert a string "word" in Trie
search(word) - To check if string "word" is present in Trie or not.
startsWith(word) - To check if there is any string in the Trie that starts with the given prefix string "word".


Three type of queries denote these operations:

Type 1: To insert a string "word" in Trie.
1 word

Type 2: To check if the string "word" is present in Trie or not.
2 word

Type 3: To check if there is any string in the Trie that starts with the given prefix string "word".
3 word


Try solving now
04
Round
Easy
HR Round
Duration40 minutes
Interview date14 Sep 2021
Coding problem1

1. Basic HR Questions

Why you want to join us?
Why should we hire you?
Questions on projects.


 

Problem approach

Tip 1 : Be confident.
Tip 2 : Show them that you can excel in your job.
Tip 3 : Be strong technically, especially in programming.

Here's your problem of the day

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

Skill covered: Programming

What is recursion?

Choose another skill to practice
Similar interview experiences
Associate Software Engineer
4 rounds | 5 problems
Interviewed by ServiceNow
2243 views
0 comments
0 upvotes
SDE - Intern
1 rounds | 2 problems
Interviewed by ServiceNow
1264 views
0 comments
0 upvotes
Associate Software Engineer
3 rounds | 3 problems
Interviewed by ServiceNow
1086 views
0 comments
0 upvotes
SDE - 1
2 rounds | 2 problems
Interviewed by ServiceNow
305 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
114579 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
57825 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
34961 views
7 comments
0 upvotes