Empty Cells after Row and Column Marks
Updated
Problem statement
An n by n board starts empty. Each one-based coordinate [row,column] in marks paints the entire row and entire column. Painting an already painted cell 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 = 5marks = [[3,2],[4,4],[3,5]]return = [16,9,6]Distinct marked rows and columns leave 4*4, 3*3, and 3*2 empty cells.
Example 2
n = 2marks = [[1,1],[1,1]]return = [1,1]Repeating a mark has no further effect.
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