InMobi CTC 55 LPA OA QUESTIONS 2026
- Posted
- 10 Oct 2026
Summary
I completed an online assessment for an SDE I position and faced four distinct coding problems covering range queries, substring matching with swaps, service dependency planning, and constrained maximum subarray queries.
How it went
Hi Everyone, Recently I gave Inmobi online assessment for the profile of SDE I, I found the questions quite unique so sharing them for the community here:
- There was a long story which I don't remember, but here is the gist of the question as I remember it, you are given an array of size N and M queries of form (li, ri) and basically we had to return maximum subarray sum from range (li,ri) for all the queries, 1<=N<=50000, -15000<= A[i] <= 15000, 1 <= (li,ri) <= N, 1 <= M <= 50000
- Again long story was there, but the gist is We are given a string of S length N, and another shorter string U, of length M, we have to return the number of substrings of N that are equal to U, but the twist is, if the position of 2 consecutive elements are swapped then also it's a valid match ex. S = abcacbabc, and U = abc then we have to find abc, acb, bac inside S and return the number of matches, constraints were 1<= M <= N <= 200000, answer is guaranteed to be a 32 bit signed integer
- A microservice platform have N services, from 1 to N, some services depend on another services, ex. if A depends on B, then if we start B service A will automatically start, a service with no dependencies can never start on its own and any service can be cold started, we have to find the minimum number of cold starts that we need to do in order to start all the services, 1<= N <= 1e5, 0<= M <= 2*1e5, where M is number of dependencies
- Was a follow-up of question 1, we are given an array of size N representing profit and loss incurred on ith day, M queries of the form x1,y1,x2,y2 where x1,y1 is the opening window and x2,y2 is the closing window, position must open on day i with x1<= i <= y1 and close on day j with x2 <= j <= y2 , it covers the unbroken stretch a[i] + a[i+1] + .... + a[j], for each query we had to return the maximum subarray sum, since the question might be unclear here is an example, n = 5, a = [10,-40,-30,30,40] , m = 2, 1 3 3 5 and 2 4 3 5 answer is for first query best run is from day 3 to day 5 ans = 40, for 2nd query best run is from day 4 to day 5, ans = 70
that's all, wish you all the very best :)
Questions asked (4)
- 01
Maximum Subarray Sum for Range Queries
Data Structures & Algorithms
Given an array A of size N and M queries (li, ri). For each query return the maximum subarray sum that lies completely within the segment [li, ri]. Constraints: 1 ≤ N ≤ 50000, -15000 ≤ A[i] ≤ 15000, 1 ≤ M ≤ 50000, 1 ≤ li ≤ ri ≤ N.
- 02
Count Substrings with One Swap Allowed
Data Structures & Algorithms
Given a string S of length N and a pattern U of length M (M ≤ N). Count the number of substrings of S that match U either exactly or after swapping any two consecutive characters in the substring. Example: S = "abcacbabc", U = "abc" → matches are "abc", "acb", "bac". Constraints: 1 ≤ M ≤ N ≤ 200000. The answer fits in a 32‑bit signed integer.
- 03
Minimum Cold Starts for Service Dependency Graph
Data Structures & Algorithms
A microservice platform has N services numbered 1..N. Some services depend on others (directed edges). If service B is started, any service A that depends on B starts automatically. Services with no dependencies cannot start on their own, but any service can be cold‑started manually. Determine the minimum number of manual (cold) starts required to have all services running. Constraints: 1 ≤ N ≤ 10⁵, 0 ≤ M ≤ 2·10⁵ (M = number of dependency edges).
- 04
Maximum Subarray Sum with Opening and Closing Windows
Data Structures & Algorithms
Given an array A of size N representing daily profit/loss, and M queries each defined by four indices (x1, y1, x2, y2). The opening day i must satisfy x1 ≤ i ≤ y1, the closing day j must satisfy x2 ≤ j ≤ y2, and i ≤ j. For each query return the maximum possible sum of a contiguous subarray A[i] + … + A[j] that respects those windows. Example: N=5, A=[10,-40,-30,30,40], queries: (1,3,3,5) → best subarray is days 3‑5, sum = 40; (2,4,3,5) → best subarray is days 4‑5, sum = 70.