ServiceNow Coding Interview Questions: OA, Technical Interview & Hiring Manager Round
ServiceNow hires freshers in India almost entirely into its Associate Software Engineer (ASE) track out of its Hyderabad development center, through both campus drives at IITs, NITs, and other colleges, and off campus applications. The bar is competitive, one panelist was quoted telling candidates that "competitive programming is a must, other skills are secondary."
This guide is organized by interview stage, HackerRank OA, technical interview, and hiring manager round, based on questions actually reported by candidates. Every problem includes the exact question, a worked example, the right approach, and time or space complexity.
Note that ServiceNow the employer tests general DSA and CS fundamentals for its Associate Software Engineer role, not ServiceNow the platform. If you see prep material focused on ITSM, ACLs, or Business Rules, that is for platform developer roles at companies that use ServiceNow, not for this interview.
ServiceNow's Hiring Process for Associate Software Engineer Roles
1. Application and Eligibility
- B.E./B.Tech, M.E./M.Tech, or MCA with 0 to 2 years of experience. Apply via careers.servicenow.com or your campus placement cell.
- The job description explicitly calls out data structures, algorithms, OOP design patterns, and a passion for JavaScript and the web as a platform.
2. Online Assessment (HackerRank) 60 to 90 minutes
- One to two DSA coding problems, easy to medium difficulty, plus 10 to 15 MCQs on operating systems, DBMS, and algorithms.
- Some recent cycles split this into two separate HackerRank tests, an easier mixed language round covering JavaScript, SQL, and Python, followed by a harder DSA only round for those who clear the first.
- Webcam and tab switch monitoring are commonly enabled.
3. Technical Interview Rounds 1 to 2 rounds, 45 to 100 minutes each
- Live DSA coding on a shared screen or document, CS fundamentals, and a walkthrough of your resume and projects.
4. Hiring Manager Round 30 to 90 minutes
- A mix of technical questions, sometimes light system design, and behavioural or situational questions about why ServiceNow and how you handle ambiguity.
5. Offer
- Total process typically runs three to five rounds depending on the year and campus, with results communicated within one to two weeks.
Preparation Resources
Part 1 ServiceNow Online Assessment (OA) Questions
The OA runs on HackerRank, 60 to 90 minutes, one to two DSA problems plus CS fundamentals MCQs. Problems lean easy to medium.
1. Word Ladder Medium
Given a begin word, an end word, and a word list, find the length of the shortest transformation sequence where each step changes exactly one letter and every intermediate word must exist in the word list.
Input: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log","cog"]
Output: 5
Why: hit -> hot -> dot -> dog -> cog
Approach: Treat each word as a node and build a graph implicitly by changing one letter at a time. Run BFS from the begin word, since BFS guarantees the shortest path in an unweighted graph.
Complexity: Time O(n * 26 * L) where L is word length · Space O(n)
Follow-up: How would you return the actual transformation sequence instead of just its length?
2. Nearest Palindromic Number Medium
Given a number as a string, find the palindrome closest to it that is not the number itself. If two palindromes are equally close, return the smaller one.
Input: n = "123"
Output: "121"
Approach: Generate a small set of palindrome candidates by mirroring the prefix of the number, and also checking one above and one below that prefix, plus edge cases like 999 to 1001. Compare absolute differences to pick the closest.
Complexity: Time O(L) where L is the number of digits · Space O(L)
Follow-up: How would your approach change if the input could be arbitrarily large, beyond standard integer range?
3. Longest Palindromic Substring Medium
Given a string, find its longest palindromic substring, ideally using constant extra space beyond the output.
Input: s = "babad"
Output: "bab" (or "aba", both valid)
Approach: Expand around every possible center, both single character centers and between character centers, tracking the longest palindrome found. This avoids the extra space a DP table would need.
Complexity: Time O(n^2) · Space O(1)
Follow-up: Can you extend this to an O(n) solution using Manacher's algorithm?
4. Count Distinct Pairs With Given Sum Easy
Given an array of integers and a target sum, count the number of distinct pairs whose values add up to the target.
Input: arr = [1, 5, 7, 1, 5], target = 6
Output: 2
Why: (1, 5) and (1, 5) are the same distinct pair, counted once
Approach: Use a hash set to track numbers seen so far. For each element, check if its complement exists, and use a separate set to avoid counting the same pair twice.
Complexity: Time O(n) · Space O(n)
Follow-up: How would you handle this if duplicates should be counted separately instead of as distinct pairs?
5. Count Distinct Palindromic Substrings Medium
Given a string, find the count of all distinct palindromic substrings within it.
Input: s = "abaaa"
Output: 5
Why: a, b, aa, aba, aaa are the distinct palindromic substrings
Approach: Expand around every center to generate all palindromic substrings, then insert each into a hash set to automatically deduplicate before counting.
Complexity: Time O(n^2) · Space O(n^2) in the worst case
Follow-up: How would you count total palindromic substrings, including duplicates, more efficiently?
6. Make the Array Beautiful Medium
Given an array, find the minimum number of operations needed to make all elements equal by repeatedly subtracting the same value from every non zero element in one operation.
Input: nums = [1, 5, 0, 3, 5]
Output: 3
Why: subtract 1 from all non-zero elements, then 3, then 1 more
Approach: Count the number of distinct non zero values in the array. Each operation can eliminate exactly one distinct value, so the answer equals the count of distinct non zero values.
Complexity: Time O(n) · Space O(n)
Follow-up: What if operations could subtract different amounts from different elements in one step?
Part 2 ServiceNow Technical Interview Questions
The technical interview rounds combine live DSA coding on a shared document with core CS fundamentals and a deep dive into your resume and projects.
7. LRU Cache Medium
Design and implement a Least Recently Used cache that supports get and put in O(1) time, evicting the least recently used entry when the cache is full.
Input: capacity = 2, put(1,1), put(2,2), get(1), put(3,3), get(2)
Output: 1, -1
Approach: Combine a hash map for O(1) lookup with a doubly linked list to track usage order, moving accessed nodes to the front and evicting from the back.
Complexity: Time O(1) per operation · Space O(capacity)
Follow-up: How would you make this cache thread safe for concurrent access?
8. House Robber III Medium
Given a binary tree where each node has a value, find the maximum sum you can rob without robbing two directly connected nodes.
Input: root = [3,2,3,null,3,null,1]
Output: 7
Why: rob nodes 3, 3, and 1 (the root's grandchildren plus the deepest leaf)
Approach: For each node, compute two values with post order recursion, the best sum if you rob this node, and the best sum if you do not, since robbing a node excludes robbing its direct children.
Complexity: Time O(n) · Space O(h) for recursion depth
Follow-up: How would this change if you could rob a node and one of its children, but not both children?
9. Implement a Queue Using Two Stacks Easy
Implement a first in first out queue using only two stacks, supporting push, pop, peek, and empty.
Input: push(1), push(2), peek(), pop(), empty()
Output: 1, 1, false
Approach: Use one stack for incoming elements. When a pop or peek is requested and the output stack is empty, transfer all elements from the input stack to the output stack, reversing their order to simulate FIFO.
Complexity: Time O(1) amortized per operation · Space O(n)
Follow-up: Can you implement a stack using two queues instead?
10. Reverse a Linked List Easy
Given the head of a singly linked list, reverse it in a single pass and return the new head.
Input: 1 -> 2 -> 3 -> 4
Output: 4 -> 3 -> 2 -> 1
Approach: Walk through the list with three pointers, previous, current, and next, reversing each link as you go, then return the final previous pointer as the new head.
Complexity: Time O(n) · Space O(1)
Follow-up: How would you reverse only a sublist between two given positions?
11. Kth Largest Element in an Array Medium
Given an unsorted array, find the kth largest element without fully sorting the array.
Input: nums = [3,2,1,5,6,4], k = 2
Output: 5
Approach: Maintain a min heap of size k, pushing every element and popping whenever the heap exceeds size k. The top of the heap at the end is the kth largest.
Complexity: Time O(n log k) · Space O(k)
Follow-up: How would you solve this in O(n) average time using quickselect?
12. Top View of a Binary Tree Medium
Given a binary tree, print the nodes visible when viewed from directly above, from left to right.
Input: a tree with root 1, left child 2, right child 3, left.right = 4
Output: 2, 1, 3
Approach: Assign each node a horizontal distance from the root, decreasing by 1 to the left and increasing by 1 to the right. Do a level order traversal and keep the first node recorded at each horizontal distance.
Complexity: Time O(n log n) · Space O(n)
Follow-up: How would you find the bottom view instead, where the last node at each horizontal distance is kept?
13. Copy a Linked List With Random Pointer Medium
Given a linked list where each node has a next pointer and a random pointer that can point to any node or null, create a deep copy of the list.
Input: head with values [7,13,11,10,1] and assorted random pointers
Output: a fully independent deep copy with matching next and random pointers
Approach: First pass, create a copy of each node and interleave it right after its original. Second pass, set each copy's random pointer using the original's random pointer's next (the copy). Third pass, unweave the two lists.
Complexity: Time O(n) · Space O(1) excluding the output list
Follow-up: Can you solve this using a hash map instead, and what is the space trade-off?
Part 3 ServiceNow Hiring Manager Round and Onsite Questions
The hiring manager round mixes DSA, light system design, and behavioural questions about why ServiceNow and how you handle ambiguity.
14. Validate a Binary Search Tree Medium
Given a binary tree, determine whether it is a valid binary search tree.
Input: root = [5,1,4,null,null,3,6]
Output: false
Why: node 4's left child 3 is less than 5, violating BST rules for the whole subtree
Approach: Recurse with a valid range for each node, starting at negative to positive infinity. Each left child must be less than the current upper bound, and each right child must be greater than the current lower bound.
Complexity: Time O(n) · Space O(h) for recursion depth
Follow-up: How would you validate a BST with an inorder traversal instead?
15. Non-overlapping Intervals Medium
Given a list of intervals, find the minimum number of intervals you need to remove to make the rest non overlapping.
Input: intervals = [[1,2],[2,3],[3,4],[1,3]]
Output: 1
Why: remove [1,3]
Approach: Sort intervals by end time. Greedily keep an interval if it starts after the previous kept interval ends, otherwise count it as removed, since keeping the earlier ending interval leaves more room for future intervals.
Complexity: Time O(n log n) · Space O(1) excluding sort space
Follow-up: How would you modify this to find the maximum number of non overlapping intervals directly?
16. Wildcard Pattern Matching Hard
Given a string and a pattern with support for ? matching any single character and * matching any sequence of characters including empty, determine if the pattern matches the entire string.
Input: s = "adceb", p = "*a*b*"
Output: true
Approach: Build a 2D DP table where dp[i][j] represents whether the first i characters of the string match the first j characters of the pattern, handling * by carrying forward both the "match nothing" and "match one more character" cases.
Complexity: Time O(m*n) · Space O(m*n), reducible to O(n) with a rolling array
Follow-up: How would this differ if the pattern also needed to support regex style . and * semantics instead?
17. Lowest Common Ancestor of a BST Medium
Given a binary search tree and two nodes, find their lowest common ancestor.
Input: root = [6,2,8,0,4,7,9], p = 2, q = 8
Output: 6
Approach: Use the BST property. Starting from the root, if both target values are less than the current node, move left. If both are greater, move right. Otherwise the current node is the split point and the answer.
Complexity: Time O(h) where h is tree height · Space O(1) iteratively
Follow-up: How would your solution change for a general binary tree that is not a BST?
18. Letter Combinations of a Phone Number Medium
Given a string of digits from 2 to 9, return all possible letter combinations that the number could represent on a phone keypad.
Input: digits = "23"
Output: ["ad","ae","af","bd","be","bf","cd","ce","cf"]
Approach: Use backtracking, building up a combination one digit at a time by trying each letter mapped to the current digit, then recursing to the next digit.
Complexity: Time O(4^n * n) in the worst case · Space O(n) for recursion
Follow-up: How would you generate combinations in sorted order without extra sorting?
19. Detect a Loop in a Linked List Easy
Given the head of a linked list, determine whether it contains a cycle.
Input: head with a cycle back to the second node
Output: true
Approach: Use Floyd's cycle detection, two pointers moving at different speeds. If a fast pointer moving two steps at a time ever equals a slow pointer moving one step at a time, a cycle exists.
Complexity: Time O(n) · Space O(1)
Follow-up: How would you find the exact node where the cycle begins?
20. Find the Middle of a Linked List Easy
Given the head of a singly linked list, return the middle node. If there are two middle nodes, return the second one.
Input: 1 -> 2 -> 3 -> 4 -> 5
Output: 3
Approach: Use the slow and fast pointer technique. The slow pointer moves one step at a time while the fast pointer moves two steps, so when the fast pointer reaches the end, the slow pointer is at the middle.
Complexity: Time O(n) · Space O(1)
Follow-up: How would you find the middle without knowing the list length in advance and without a second traversal?
21. Minimum Speed to Finish in Time Medium
Given piles of items and a time limit, find the minimum constant processing speed needed to finish all piles within the limit, where each pile is processed independently.
Input: piles = [3,6,7,11], h = 8
Output: 4
Approach: Binary search on the answer speed, from 1 to the maximum pile size. For each candidate speed, calculate the total time needed across all piles, and narrow the search range based on whether that time fits within the limit.
Complexity: Time O(n log(max pile)) · Space O(1)
Follow-up: How would you adapt this if different piles had different minimum required speeds?
22. Segregate 0s and 1s in an Array Easy
Given an array containing only 0s and 1s, rearrange it in place so all 0s come before all 1s in a single pass.
Input: [1, 0, 1, 0, 0, 1]
Output: [0, 0, 0, 1, 1, 1]
Approach: Use two pointers starting from both ends. Move the left pointer forward while it points at 0, move the right pointer backward while it points at 1, then swap when both are stuck, and continue until the pointers cross.
Complexity: Time O(n) · Space O(1)
Follow-up: How would you extend this to segregate three values, such as the Dutch National Flag problem with 0s, 1s, and 2s?
23. Design a System Like LinkedIn Hard
For freshers, this round is a lighter version of system design focused on your reasoning process rather than distributed systems depth. You will typically be asked to design a simplified version of a professional networking platform.
Discussion points: functional requirements (profiles, connections, feed), a basic database
schema (users, connections, posts), how you would handle a feed query, and where caching
could help reduce database load.
Approach: Start by clarifying functional and non functional requirements out loud. Sketch a simple database schema for users, connections, and posts. Discuss how you would generate a feed, either by querying connections at read time or precomputing a feed at write time, and where a cache would reduce repeated database hits.
Complexity: Not applicable, evaluated on structured reasoning and trade-off awareness rather than a single correct answer
Follow-up: How would your design change if the platform needed to support millions of users instead of a few thousand?
Preparation Tips
- DSA fundamentals over platform trivia. ServiceNow the employer tests general data structures and algorithms for the Associate Software Engineer role, not knowledge of the ServiceNow platform itself. Focus your prep on LeetCode style problems, not ITSM concepts.
- JavaScript matters more than at most companies. The job description explicitly calls out JavaScript and the web as a platform, since the Now Platform itself is built on JavaScript. Being comfortable writing and reasoning about JavaScript is a real advantage.
- Practice explaining your reasoning out loud. Multiple rounds are conducted on a shared document without an IDE, so practice thinking through a problem verbally before and while you code.
- Revise linked lists, trees, and two pointer techniques specifically. These three categories appear disproportionately often across reported OA and interview questions.
Join our Telegram group to discuss more ServiceNow interview questions and prep strategies!