Sprinklr Coding Round Questions With Solutions
Last updated 2026-11-19
Sprinklr coding rounds are commonly reported at medium level with a lean towards problems that resemble real systems work: scheduling, counting, feeds and rate limiting. The ten practice problems below follow that flavour, each with an approach, code, complexity and a typical mistake.
They are practice problems, not real papers. For design and behavioural questions see Sprinklr interview questions, and for general pacing see how to crack a DSA coding round.
How to practise
Solve two problems in 60 to 75 minutes. Read constraints first: they tell you whether O(n squared) is acceptable. Keep your code modular, since interviewers reading it value helper functions and clear names.
Hiring status
We have no sourced Sprinklr hiring dates, numbers or test-format facts, so none are stated. Check the company's own careers site for current roles. See how to crack the online assessment for test strategy.
Sprinklr Coding Round Questions With Solutions: questions with worked answers
1 Task scheduler with cooldown.
mediumGiven tasks with counts and a cooldown n between identical tasks, the minimum time is max(len(tasks), (maxCount - 1) times (n + 1) + numberOfTasksWithMaxCount). The frame length is driven by the most frequent task; other tasks fill its idle gaps. O(len) time. Mistake: simulating with a heap when a formula suffices, or forgetting the case with several tasks tied for the maximum.
pythonfrom collections import Counter def least_interval(tasks, n): c = Counter(tasks) mx = max(c.values()) tie = sum(1 for v in c.values() if v == mx) return max(len(tasks), (mx - 1) * (n + 1) + tie)2 Longest consecutive sequence in O(n).
mediumPut numbers in a set. For each number whose predecessor is not in the set, count upwards while successors exist. Every sequence is counted once from its start, so total work is O(n). Mistake: sorting, which is O(n log n), or starting a count from every number.
pythondef longest_consecutive(a): s, best = set(a), 0 for x in s: if x - 1 not in s: y = x while y + 1 in s: y += 1 best = max(best, y - x + 1) return best3 Design a sliding-window rate limiter.
mediumKeep a deque of request timestamps per user. On a request at time t, drop timestamps at or before t minus the window, allow if the length is below the limit, and append t. O(1) amortised per request, memory O(limit) per user. Mistake: not evicting old entries before checking the length.
pythonfrom collections import deque, defaultdict class RateLimiter: def __init__(self, limit, window): self.limit, self.window = limit, window self.hits = defaultdict(deque) def allow(self, user, t): q = self.hits[user] while q and q[0] <= t - self.window: q.popleft() if len(q) < self.limit: q.append(t) return True return False4 Insert, delete and get random element, all in O(1).
mediumStore values in a list and a map from value to its list index. To delete, swap the target with the last element, update the map, and pop. Random pick takes a random list index. Mistake: deleting from the middle of the list, which is O(n); or forgetting to update the moved element's index.
pythonimport random class RandomizedSet: def __init__(self): self.a, self.pos = [], {} def insert(self, x): if x in self.pos: return False self.pos[x] = len(self.a) self.a.append(x) return True def remove(self, x): if x not in self.pos: return False i, last = self.pos[x], self.a[-1] self.a[i] = last self.pos[last] = i self.a.pop() del self.pos[x] return True def get_random(self): return random.choice(self.a)5 Design a simple Twitter feed: post and get the 10 most recent tweets from followed users.
hardStore each user's tweets as a list of (time, id), and a follow set per user. To read the feed, merge the recent tweets of the user and each followee with a max-heap on time, popping up to 10. It costs O(f + 10 log f) with the heap seeded by each user's latest tweet. Mistake: concatenating and sorting all tweets, which is O(total log total).
pythonimport heapq from collections import defaultdict class Feed: def __init__(self): self.t = 0 self.tweets = defaultdict(list) self.follows = defaultdict(set) def post(self, u, tid): self.t += 1 self.tweets[u].append((self.t, tid)) def follow(self, a, b): self.follows[a].add(b) def unfollow(self, a, b): self.follows[a].discard(b) def feed(self, u): h = [] for v in self.follows[u] | {u}: if self.tweets[v]: i = len(self.tweets[v]) - 1 ts, tid = self.tweets[v][i] h.append((-ts, tid, v, i)) heapq.heapify(h) out = [] while h and len(out) < 10: _, tid, v, i = heapq.heappop(h) out.append(tid) if i: ts, nid = self.tweets[v][i - 1] heapq.heappush(h, (-ts, nid, v, i - 1)) return out6 Word search in a grid (backtracking).
mediumFrom each cell matching the first letter, DFS to neighbours matching the next letter, marking the cell as used while exploring and restoring it afterwards. Worst case O(cells times 3 to the power L) for word length L. Mistake: forgetting to un-mark the cell on backtrack, which blocks later paths.
pythondef exist(board, word): R, C = len(board), len(board[0]) def dfs(r, c, i): if i == len(word): return True if not (0 <= r < R and 0 <= c < C) or board[r][c] != word[i]: return False ch, board[r][c] = board[r][c], '#' found = any(dfs(r + dr, c + dc, i + 1) for dr, dc in ((1,0),(-1,0),(0,1),(0,-1))) board[r][c] = ch return found return any(dfs(r, c, 0) for r in range(R) for c in range(C))7 Decode ways: count the ways to decode a digit string as letters (1 to 26).
mediumdp[i] counts decodings of the first i digits. Add dp[i-1] if the last digit is non-zero, and dp[i-2] if the last two digits form 10 to 26. O(n) time, O(1) space with two variables. Mistake: treating "0" as decodable or accepting two-digit numbers with a leading zero.
pythondef num_decodings(s): if not s or s[0] == '0': return 0 prev2, prev1 = 1, 1 for i in range(1, len(s)): cur = 0 if s[i] != '0': cur += prev1 if 10 <= int(s[i-1:i+1]) <= 26: cur += prev2 prev2, prev1 = prev1, cur return prev1javastatic int numDecodings(String s) { if (s.isEmpty() || s.charAt(0) == '0') return 0; int p2 = 1, p1 = 1; for (int i = 1; i < s.length(); i++) { int cur = 0; if (s.charAt(i) != '0') cur += p1; int two = Integer.parseInt(s.substring(i - 1, i + 1)); if (two >= 10 && two <= 26) cur += p2; p2 = p1; p1 = cur; } return p1; }8 Subarrays with exactly K distinct integers.
hardUse the identity exactly(K) = atMost(K) minus atMost(K - 1). atMost uses a sliding window with a frequency map, adding the window length for each right end. O(n). Mistake: trying to count exactly K directly with one window, which cannot shrink correctly.
pythonfrom collections import defaultdict def subarrays_k_distinct(a, k): def at_most(k): cnt, left, res = defaultdict(int), 0, 0 for right, x in enumerate(a): cnt[x] += 1 while len(cnt) > k: cnt[a[left]] -= 1 if cnt[a[left]] == 0: del cnt[a[left]] left += 1 res += right - left + 1 return res return at_most(k) - at_most(k - 1)9 Find the first non-repeating character in a stream.
mediumKeep a count map and a queue of candidate characters. When a character arrives, increment its count and enqueue it if new; before answering, pop from the front while the front's count is above one. Amortised O(1) per character. Mistake: rescanning the whole string every time.
pythonfrom collections import deque, Counter class FirstUnique: def __init__(self): self.cnt, self.q = Counter(), deque() def add(self, ch): self.cnt[ch] += 1 if self.cnt[ch] == 1: self.q.append(ch) def first(self): while self.q and self.cnt[self.q[0]] > 1: self.q.popleft() return self.q[0] if self.q else None10 Merge overlapping log intervals from several servers.
easyCombine all intervals into one list, sort by start, and sweep, extending the current interval while the next starts at or before its end. O(N log N) for N total intervals. If every server list is already sorted, a k-way merge with a heap gives the same order without a full sort.
pythondef merge_logs(lists): ivs = sorted(iv for l in lists for iv in l) out = [] for s, e in ivs: if out and s <= out[-1][1]: out[-1][1] = max(out[-1][1], e) else: out.append([s, e]) return out
Frequently asked questions
How hard is the Sprinklr coding round?
Commonly reported as medium, with some harder follow-ups. Practise arrays, hashing, heaps, graphs and dynamic programming.
How many problems should I expect?
Reports vary. Expect around two in an online test, but check your own invitation.
Do I need system design for the coding round?
No. System design belongs to later interviews, mainly for experienced roles.
Which platform is used?
It varies by role and year, so read your invitation instead of relying on old reports.
Related guides
More in Company Interview Questions
- Sprinklr Interview Questions and Answers
- Swiggy Coding Round Questions with Solutions
- Swiggy Interview Questions and Answers
- Synopsys Coding Round Questions with Solutions
- Synopsys Interview Questions and Answers for India R&D Software Roles
- Target Coding Round Questions
- Target Interview Questions with Answers
- TCS Coding Round Questions with Solutions
- TCS Interview Questions for Freshers
- Tech Mahindra Coding Round Questions with Solutions
- Tech Mahindra Interview Questions for Freshers
- Texas Instruments Coding Round Questions with Solutions