Empty Cells after Single-Cell Marks
Updated
Problem statement
An n by n board starts empty. Each one-based coordinate [row,column] in marks paints that single cell. Painting a cell again has no additional effect. Return the number of empty cells after every operation, in order.
Function
emptyCells(n: int, marks: int[][]) → long[]Examples
Example 1
n = 3marks = [[1,1],[2,3],[1,1]]return = [8,7,7]Only two distinct cells are painted.
Example 2
n = 1marks = [[1,1]]return = [0]The only cell becomes painted.
Constraints
- For this exercise, assume 1 <= n <= 100000 and marks.length <= 200000.
- Every mark contains two coordinates between 1 and n.
More Intuit Online Assessment questions
- Employee Promotion OpportunitiesOA · Seen Oct 2026
- Next Pascal Row CoefficientOA · Seen Oct 2026
- Parse Router LogsOA · Seen Oct 2026
- Longest Repeated Letter Block with Adjacent SwapsOA · Seen Oct 2026
- Maximum Square-Free DivisorOA · Seen Oct 2026
- Two Tribes from Taller-Person CountsOA · Seen Oct 2026
- Shortest Path from an Encoded GraphOA · Seen Sep 2026
- Oldest and Youngest EmployeesOA · Seen Sep 2026
- Pressure-Isolation Shutdown OrderOA · Seen Sep 2026
- Submask Sum QueriesOA · Seen Sep 2026
Similar questions at other companies
- Bank Accounts with Balance HistoryMeta · OAMeta interview questions
- Top K Frequent ElementsAmazon · OA · PHONE SCREEN
- Count Overlapping Square PairsRamp · OARamp interview questions
- Minimum Rounds to Complete All TasksInfosys · OAInfosys interview questions
- Count Servers With No Requests in a Time WindowIBM · OAIBM interview questions
- Find Valid SET Card TriplesSnowflake · OA · PHONE SCREENSnowflake interview questions
- Maximum Escape Game ScoreMicrosoft · OAMicrosoft interview questions
- Stacked Item and Category DiscountsPalantir · OAPalantir interview questions
- Minimum Distinct Prefix CostChubb · OAChubb interview questions
- Count One-Swap Number PairsCapital One · OACapital One interview questions