i
ServiceNow
Work with us
Filter interviews by
Level order traversal of a tree using Queue
Create a queue and add the root node to it
While the queue is not empty, remove the front node and print its value
Add the left and right child nodes of the removed node to the queue
Repeat until the queue is empty
Recursively delete a linked list
Create a recursive function that takes the head of the linked list as input
Base case: if the head is null, return
Recursively call the function with the next node as input
Delete the current node
Find median of 2 sorted arrays in O(log N) time complexity and O(1) space complexity
Use binary search to find the partition point in both arrays
Calculate the median based on the partition point and array sizes
Adjust the partition points based on the median value
Repeat until the partition points are at the median
Handle edge cases such as empty arrays and uneven array sizes
Find product of each element of an array except that element in O(N) time complexity without using / operation
Use prefix and suffix products
Multiply prefix and suffix products for each element to get the final product
Handle edge cases where array has 0 or 1 element separately
Design a system for putting newspapers using classes and functions
Create a Newspaper class with attributes like title, date, and content
Create a Publisher class with methods to publish and distribute newspapers
Create a Subscriber class with methods to subscribe and receive newspapers
Use inheritance to create different types of newspapers like daily, weekly, etc.
Implement a database to store newspaper information a...
Recursively delete a tree by deleting all its child nodes and then the parent node.
Start from the leaf nodes and delete them first.
Then move up to the parent nodes and delete them.
Repeat until the root node is deleted.
Use post-order traversal to ensure child nodes are deleted before parent nodes.
Anagram of strings in O(1) space complexity
Use a fixed size array of integers to store the frequency of characters in the first string
Iterate through the second string and decrement the frequency of each character in the array
If all the frequencies are zero, then the strings are anagrams
Return true or false accordingly
Reverse level order traversal of a tree using Queue
Create a queue and push the root node into it
While the queue is not empty, pop the front node and push its children into the queue
Add the popped node to a stack
Once the queue is empty, pop elements from the stack and print them
BFS and DFS are graph traversal algorithms. BFS explores nodes level by level while DFS explores nodes depth by depth.
BFS uses a queue while DFS uses a stack or recursion.
BFS is optimal for finding shortest path while DFS is optimal for finding a path between two nodes.
BFS requires more memory as it stores all the nodes at each level while DFS requires less memory.
BFS can be used to find connected components while...
Recursively delete a linked list from the end.
Start from the head and recursively traverse to the end of the list.
Delete the last node and set the second last node's next pointer to null.
Repeat until the entire list is deleted.
Use a recursive function to implement the deletion process.
I applied via Job Portal and was interviewed in Oct 2024. There were 3 interview rounds.
2 questions in coding assessment
Two coding questions, minimum window substring, other I forgot
Design a cloud storage system similar to Google Drive with features for file management and sharing.
User Authentication: Implement secure login and user management.
File Upload/Download: Allow users to upload and download files easily.
File Sharing: Enable users to share files with others via links or email.
Version Control: Keep track of file versions and allow users to revert changes.
Storage Management: Provide users wi...
I applied via Approached by Company and was interviewed in Jan 2024. There was 1 interview round.
Topological sort is a linear ordering of vertices in a directed acyclic graph where for every directed edge uv, vertex u comes before vertex v.
Create a list to store the topological ordering of vertices.
Find a vertex with no incoming edges and add it to the list.
Remove the vertex and its outgoing edges from the graph.
Repeat the process until all vertices are added to the list.
The Tower of Hanoi is a classic problem that involves moving disks from one peg to another, following specific rules.
Start by moving the top n-1 disks from the source peg to the auxiliary peg.
Move the largest disk from the source peg to the target peg.
Move the n-1 disks from the auxiliary peg to the target peg.
Repeat the process recursively for the n-1 disks on the auxiliary peg.
Continue until all disks are moved to th...
I applied via Company Website and was interviewed before Mar 2023. There was 1 interview round.
The Meeting Rooms problem involves determining if meeting times overlap using intervals.
Use an array of intervals to represent meeting start and end times.
Sort the intervals by start time to facilitate comparison.
Check for overlaps by comparing the end time of the previous meeting with the start time of the current meeting.
If any meeting starts before the previous one ends, there is an overlap.
I applied via LinkedIn and was interviewed in Sep 2022. There were 4 interview rounds.
I appeared for an interview in Oct 2022.
2 coding questions on DSA - Trees and Strings
Given an array of N meetings, find a subarray with sum 0.
Use a hash table to store the cumulative sum of the array elements.
If the same sum is encountered again, it means the subarray between the two indices has a sum of 0.
Handle edge cases like when the subarray starts from index 0 or when the subarray ends at the last index.
I appeared for an interview in May 2022.
Round duration - 60 Minutes
Round difficulty - Easy
It starts with a brief introduction and then the interviewer move to coding questions
You are provided with an integer N
. The objective is to return a 2-dimensional list representing Pascal’s triangle up to row N
.
A Pascal's triangle is a triangular arr...
Return a 2D list representing Pascal's triangle up to row N.
Iterate through each row up to N, calculating each value based on the values from the previous row
Use a nested loop to generate the triangle efficiently
Consider edge cases like N=1 separately to return [[1]]
Remember to handle the constraints given in the problem statement
Given an N x M
integer matrix, if an element is 0, set its entire row and column to 0's, and return the matrix. Specifically, if a cell has a value 0 (i.e., matrix[i][j]...
To solve the Set Matrix Zeros problem, we can use O(1) space by utilizing the first row and column to store information about zeros in the rest of the matrix.
Iterate through the matrix and use the first row and column to mark rows and columns that need to be zeroed out.
After marking, iterate through the matrix again and zero out the rows and columns based on the marks in the first row and column.
Remember to handle the ...
Round duration - 60 Minutes
Round difficulty - Easy
It starts with a brief introduction and then the interviewer move to coding questions. It basically consists of two coding questions
and some general questions like why should we hire you?
Your task is to find the ‘K-th’ smallest element in a given Binary Search Tree (BST).
A Binary Search Tree is a binary tree in which for each node, all elements...
Find the K-th smallest element in a Binary Search Tree.
Implement a function to find the K-th smallest element in a BST
Traverse the BST in-order and keep track of the count of nodes visited
Return the value of the K-th smallest node
Handle cases where the K-th smallest element does not exist by returning -1
Determine if an array contains a Pythagorean triplet by checking whether there are three integers x, y, and z such that x2 + y2 = z2 within the array.
The first lin...
Detect if an array contains a Pythagorean triplet by checking if there are three integers x, y, and z such that x^2 + y^2 = z^2.
Iterate through all possible combinations of three integers in the array and check if x^2 + y^2 = z^2.
Use a nested loop to generate all possible combinations efficiently.
Return 'yes' if a Pythagorean triplet is found, otherwise return 'no'.
Tip 1 : Practice questions on leetcode
Tip 2 : Understand the best solutions in depth and algorithm used
Tip 3 : Ask clarifying questions to the interviewer and break the problem to smaller sub parts
Tip 1 : Highlight your most impactful work on the resume
Tip 2 : Keep it easy to understand
Top trending discussions
Some of the top questions asked at the ServiceNow Software Engineer interview -
The duration of ServiceNow Software Engineer interview process can vary, but typically it takes about less than 2 weeks to complete.
based on 10 interview experiences
Difficulty level
Duration
based on 38 reviews
Rating in categories
Software Engineer
538
salaries
| ₹23.1 L/yr - ₹40 L/yr |
Senior Software Engineer
471
salaries
| ₹30 L/yr - ₹54.7 L/yr |
Technical Support Engineer
146
salaries
| ₹11.7 L/yr - ₹20.6 L/yr |
Software Developer
120
salaries
| ₹22.3 L/yr - ₹39.5 L/yr |
Content Data Analyst
95
salaries
| ₹2.8 L/yr - ₹4.1 L/yr |
Oracle
Amdocs
Automatic Data Processing (ADP)
24/7 Customer