SquadStack.ai OA (On - Campus, Core Engineer)
Summary
I completed SquadStack.ai's on‑campus online assessment, which included aptitude, core CS, coding, and SQL questions.
Full Experience
SquadStack.ai OA Experience
- 10 Aptitude questions
- 15 Core CS questions
- 2 coding questions
- 1 SQL question
Had negative marking (-0.5)
The two coding questions were:
1. Decode Ways - Leetcode 91 (with a twist)
LeetCode 91 - Decode Ways was the base question. It had a small twist that the way you read a character is associated with a cost and you have to minimise the cost of reading the string. Solvable if you had solved this before.
2. Minimum Seats Required - Car Pooling — LeetCode 1094
You are given a car that travels in one direction along a route.
You are given an array stops, where each element is:
[p, f, t]
p = number of passengers f = point where the passengers get into the car t = point where the passengers get out of the car
Passengers can get in and out at different points along the route.
At each point, passengers who are getting down leave the car first, and then new passengers are picked up.
Find the minimum number of seats required in the car to accommodate all passengers.
SQL Problem: Find the Dominant Seller
Problem Description
You are given two tables: Sellers and Orders.
Sellers
| Column | Type | Description |
|---|---|---|
seller_id | INT | Primary key |
seller_name | VARCHAR | Name of the seller |
Orders
| Column | Type | Description |
|---|---|---|
order_id | INT | Primary key |
seller_id | INT | Foreign key referencing Sellers |
item_qty | INT | Quantity of items sold |
item_rate | DECIMAL | Rate per item |
Task
Calculate the total revenue generated by each seller:
total_revenue = SUM(item_qty * item_rate)
A seller is considered a Dominant Seller if their total revenue is strictly greater than the combined total revenue of all other sellers.
Return the seller_id and total_revenue of all dominant sellers.
Example
Suppose the total revenues are:
Seller 1 → 1000
Seller 2 → 300
Seller 3 → 200
Seller 1 is dominant because:
1000 > 300 + 200
Therefore, the answer is:
seller_id | total_revenue
----------|--------------
1 | 1000
SQL Solution
WITH seller_revenue AS (
SELECT
seller_id,
SUM(item_qty * item_rate) AS total_revenue
FROM Orders
GROUP BY seller_id
),
total_revenue AS (
SELECT SUM(total_revenue) AS overall_revenue
FROM seller_revenue
)
SELECT
sr.seller_id,
sr.total_revenue
FROM seller_revenue sr
CROSS JOIN total_revenue tr
WHERE sr.total_revenue > tr.overall_revenue - sr.total_revenue;
Explanation
Let:
R = seller's revenue
T = total revenue of all sellers
Revenue generated by all other sellers is:
T - R
So the condition for a dominant seller is:
R > T - R
which is equivalent to:
2R > T
The CTE first calculates revenue per seller, then calculates the overall revenue, and finally identifies sellers whose revenue is greater than the combined revenue of everyone else.
Interview Questions (3)
Decode Ways with Cost Minimization
Base problem: Given a string of digits, count the number of ways to decode it (LeetCode 91). Twist: Each character read has an associated cost, and you must minimize the total cost of reading the string while still decoding it correctly.
Minimum Seats Required – Car Pooling
You are given an array of stops, each represented as [p, f, t] where p is the number of passengers, f is the point where they get into the car, and t is the point where they get out. Passengers exit before new ones board at each point. Find the minimum number of seats required to accommodate all passengers.
LeetCode 1094 – Car Pooling.
Find the Dominant Seller
Given tables Sellers(seller_id, seller_name) and Orders(order_id, seller_id, item_qty, item_rate), compute total revenue per seller (item_qty * item_rate). Return sellers whose revenue is strictly greater than the combined revenue of all other sellers.
SQL solution provided in the post.