SSE @ ServiceNow

Anonymous User
1183
Apr 03, 2025

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:
// 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.
// Ip: 10.10 John ABC def
// 10.11 Marie ABC
// 10.20 Marie Q W E
// 10.23 John ABC def
// N = 1
// M

// Op: [(John, 4)]

// Also parse log function is given which takes input as log file path, and then returns List of users and their word counts
// [(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) 🙂

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