SSE @ ServiceNow

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2025-04-03Added By Anonymous
Source: Link

Round 1

1.Coding: Search for a value on a row and column sorted 2d matrix.
2.Short discussion on a past project.
3.Discussed approach for the below:
1// Given a log file, each log consists time stamp, user name, message. Output top N users in descending order of total no of words used. 2// Ip: 10.10 John ABC def 3// 10.11 Marie ABC 4// 10.20 Marie Q W E 5// 10.23 John ABC def 6// N = 1 7// M 8 9// Op: [(John, 4)] 10 11// Also parse log function is given which takes input as log file path, and then returns List of users and their word counts 12// [(John, 2), (Marie, 1), (John, 2)]


Round 2

1.Coding:

Variation of https://leetcode.com/problems/longest-consecutive-sequence, but for prime numbers. Still expeted O(n) 🙂

1Length of Longest Consecutive prime Subsequence in unsorted array 2eg: arr[] = {36, 41, 19, 56, 35, 44, 13, 33, 17, 29, 34, 11, 92, 43, 23, 32, 42} 311, 13, 17, 19, 23, 29 -> 6 4N <= 10^7 50 <= arr[i] <= 10^7 6- Unique numbers 7- unsorted

Sieve not allowed due to the space it takes. Expected complexity of the driver algorithm - O(n). I don't really think a solutions exists.

After some time, he mentioned we can assume we have a method that returns the next prime number for a given prime number in a very efficient way.

1.Last few mins discussion on LLD of BookMyShow for movies in India.


Verdict


Rejected

Comments