Q6
Window Functions
72 stations · 12hROW_NUMBER, RANK, DENSE_RANK, LAG/LEAD, running totals, top-N per group and gaps & islands. 72 interview problems explained by Everyday Data Science (12h of video), grouped into 5 patterns such as Top-N per group, Consecutive rows / gaps & islands, Running totals & moving averages.
Start this line →- Top-N per group17
- Consecutive rows / gaps & islands13
- Running totals & moving averages7
- Ranking20
- Compare with previous / next row8
- Other19
Top-N per group
0 of 17 passed- The Most Frequently Ordered Products for Each CustomerLC 1596 · 16:38 · LeetCode PremiumMediumAmazonLeetCode ↗ (opens in a new tab)
- Highest Grade For Each StudentLC 1112 · 7:34 · LeetCode PremiumMediumGoogle · CourseraLeetCode ↗ (opens in a new tab)
- The Most Recent Orders for Each ProductLC 1549 · 10:16 · LeetCode PremiumMediumAmazonLeetCode ↗ (opens in a new tab)
- Get the Second Most Recent ActivityLC 1369 · 10:26 · LeetCode PremiumHardMicrosoftLeetCode ↗ (opens in a new tab)
- The First Day of the Maximum Recorded Degree in Each CityLC 2314 · 7:09 · LeetCode PremiumMediumLeetCode ↗ (opens in a new tab)
- All the Pairs With the Maximum Number of Common FollowersLC 1951 · 9:40 · LeetCode PremiumMediumMetaLeetCode ↗ (opens in a new tab)
- Manager of the Largest DepartmentLC 2988 · 5:45 · LeetCode PremiumMediumLeetCode ↗ (opens in a new tab)
- Customers with Maximum Number of Transactions on Consecutive DaysLC 2752 · 8:23 · LeetCode PremiumHardLeetCode ↗ (opens in a new tab)
Consecutive rows / gaps & islands
0 of 13 passed- Find the Start and End Number of Continuous RangesLC 1285 · 12:15 · LeetCode PremiumMediumMicrosoftLeetCode ↗ (opens in a new tab)
- Consecutive NumbersLC 180 · 6:46MediumGoogle · Amazon · +7 more companiesLeetCode ↗ (opens in a new tab)
- Report Contiguous DatesLC 1225 · 12:26 · LeetCode PremiumHardAmazon · MetaLeetCode ↗ (opens in a new tab)
- Consecutive Available Seats IILC 3140 · 8:33 · LeetCode PremiumMediumLeetCode ↗ (opens in a new tab)
- Products With Three or More Orders in Two Consecutive YearsLC 2292 · 11:08 · LeetCode PremiumMediumAmazonLeetCode ↗ (opens in a new tab)
- Customers With Strictly Increasing PurchasesLC 2474 · 15:14 · LeetCode PremiumHardAmazonLeetCode ↗ (opens in a new tab)
- Human Traffic of StadiumLC 601 · 6:15HardGoogle · Amazon · +4 more companiesLeetCode ↗ (opens in a new tab)
- Customers with Maximum Number of Transactions on Consecutive DaysLC 2752 · 8:23 · LeetCode PremiumHardLeetCode ↗ (opens in a new tab)
- Merge Overlapping Events in the Same HallLC 2494 · 9:34 · LeetCode PremiumHardLeetCode ↗ (opens in a new tab)
Running totals & moving averages
0 of 7 passed- Running Total for Different GendersLC 1308 · 16:51 · LeetCode PremiumMediumLeetCode ↗ (opens in a new tab)
- Restaurant GrowthLC 1321 · 10:24MediumGoogle · Amazon · +5 more companiesLeetCode ↗ (opens in a new tab)
- Find Cumulative Salary of an EmployeeLC 579 · 9:17 · LeetCode PremiumHardAmazonLeetCode ↗ (opens in a new tab)
- Flight Occupancy and Waitlist AnalysisLC 2783 · 9:55 · LeetCode PremiumMediumLeetCode ↗ (opens in a new tab)
- Merge Overlapping Events in the Same HallLC 2494 · 9:34 · LeetCode PremiumHardLeetCode ↗ (opens in a new tab)
Ranking
0 of 20 passed- The Change in Global RankingsLC 2175 · 16:04 · LeetCode PremiumMediumLeetCode ↗ (opens in a new tab)
- Consecutive Available Seats IILC 3140 · 8:33 · LeetCode PremiumMediumLeetCode ↗ (opens in a new tab)
- Compute the Rank as a PercentageLC 2346 · 7:32 · LeetCode PremiumMediumLeetCode ↗ (opens in a new tab)
- Find Peak Calling Hours for Each CityLC 2984 · 5:49 · LeetCode PremiumMediumDE ShawLeetCode ↗ (opens in a new tab)
- Premier League Table Ranking IILC 3252 · 9:57 · LeetCode PremiumMediumLeetCode ↗ (opens in a new tab)
- Count Artist Occurrences On Spotify Ranking ListLC 2669 · 2:36 · LeetCode PremiumEasyLeetCode ↗ (opens in a new tab)
- Premier League Table Ranking IIILC 3322 · 6:47 · LeetCode PremiumMediumLeetCode ↗ (opens in a new tab)
- Viewers Turned StreamersLC 2995 · 6:32 · LeetCode PremiumHardGoogle · PhonePeLeetCode ↗ (opens in a new tab)
Compare with previous / next row
0 of 8 passed- The Change in Global RankingsLC 2175 · 16:04 · LeetCode PremiumMediumLeetCode ↗ (opens in a new tab)
- First and Last Call On the Same DayLC 1972 · 9:54 · LeetCode PremiumHardAmazonLeetCode ↗ (opens in a new tab)
- Change Null Values in a Table to the Previous ValueLC 2388 · 10:31 · LeetCode PremiumMediumDeloitteLeetCode ↗ (opens in a new tab)
Other
0 of 19 passed- Game Play Analysis IIILC 534 · 6:39 · LeetCode PremiumMediumGSN GamesLeetCode ↗ (opens in a new tab)
- Biggest Window Between VisitsLC 1709 · 12:54 · LeetCode PremiumMediumLeetCode ↗ (opens in a new tab)
- Last Person to Fit in the BusLC 1204 · 10:09MediumGoogle · Amazon · +4 more companiesLeetCode ↗ (opens in a new tab)
- Group Employees of the Same SalaryLC 1875 · 8:13 · LeetCode PremiumMediumClariLeetCode ↗ (opens in a new tab)
- Median Employee SalaryLC 569 · 10:25 · LeetCode PremiumHardGoogle · AmazonLeetCode ↗ (opens in a new tab)
- Order Two Columns IndependentlyLC 2159 · 9:52 · LeetCode PremiumMediumBooking.comLeetCode ↗ (opens in a new tab)
- Product Sales Analysis IVLC 2324 · 7:59 · LeetCode PremiumMediumAmazonLeetCode ↗ (opens in a new tab)
- Find Interview CandidatesLC 1811 · 17:28 · LeetCode PremiumMediumAmazonLeetCode ↗ (opens in a new tab)
- Find the Quiet Students in All ExamsLC 1412 · 11:02 · LeetCode PremiumHardLeetCode ↗ (opens in a new tab)
- Market Analysis IILC 1159 · 11:24 · LeetCode PremiumHardAmazon · PoshmarkLeetCode ↗ (opens in a new tab)
- User Activities within Time BoundsLC 3060 · 11:31 · LeetCode PremiumHardLeetCode ↗ (opens in a new tab)
All 72 stations in order
- 1.Consecutive Available Seats (LeetCode 603)
- 2.Find the Team Size (LeetCode 1303)
- 3.Running Total for Different Genders (LeetCode 1308)
- 4.Find the Start and End Number of Continuous Ranges (LeetCode 1285)
- 5.Account Balance (LeetCode 2066)
- 6.The Most Frequently Ordered Products for Each Customer (LeetCode 1596)
- 7.Maximum Transaction Each Day (LeetCode 1831)
- 8.Game Play Analysis III (LeetCode 534)
- 9.Project Employees III (LeetCode 1077)
- 10.Biggest Window Between Visits (LeetCode 1709)
- 11.Last Person to Fit in the Bus (LeetCode 1204)
- 12.Highest Grade For Each Student (LeetCode 1112)
- 13.Restaurant Growth (LeetCode 1321)
- 14.The Most Recent Three Orders (LeetCode 1532)
- 15.Rank Scores (LeetCode 178)
- 16.The Change in Global Rankings (LeetCode 2175)
- 17.The Most Recent Orders for Each Product (LeetCode 1549)
- 18.Get the Second Most Recent Activity (LeetCode 1369)
- 19.Arrange Table by Gender (LeetCode 2308)
- 20.Group Employees of the Same Salary (LeetCode 1875)
- 21.The First Day of the Maximum Recorded Degree in Each City (LeetCode 2314)
- 22.Median Employee Salary (LeetCode 569)
- 23.Consecutive Numbers (LeetCode 180)
- 24.Order Two Columns Independently (LeetCode 2159)
- 25.Product Sales Analysis IV (LeetCode 2324)
- 26.Find Interview Candidates (LeetCode 1811)
- 27.Find the Quiet Students in All Exams (LeetCode 1412)
- 28.Suspicious Bank Accounts (LeetCode 1843)
- 29.All the Pairs With the Maximum Number of Common Followers (LeetCode 1951)
- 30.Report Contiguous Dates (LeetCode 1225)
- 31.Find Expensive Cities (LeetCode 2987)
- 32.Election Results (LeetCode 2820)
- 33.Status of Flight Tickets (LeetCode 2793)
- 34.Consecutive Available Seats II (LeetCode 3140)
- 35.Market Analysis II (LeetCode 1159)
- 36.Active Users (LeetCode 1454)
- 37.First and Last Call On the Same Day (LeetCode 1972)
- 38.Longest Winning Streak (LeetCode 2173)
- 39.Products With Three or More Orders in Two Consecutive Years (LeetCode 2292)
- 40.Compute the Rank as a Percentage (LeetCode 2346)
- 41.Customers With Strictly Increasing Purchases (LeetCode 2474)
- 42.Year on Year Growth Rate (LeetCode 3214)
- 43.Find Longest Calls (LeetCode 3124)
- 44.Top Percentile Fraud (LeetCode 3055)
- 45.Manager of the Largest Department (LeetCode 2988)
- 46.Find Third Transaction (LeetCode 2986)
- 47.Find Peak Calling Hours for Each City (LeetCode 2984)
- 48.Premier League Table Ranking (LeetCode 3246)
- 49.Find Cumulative Salary of an Employee (LeetCode 579)
- 50.Human Traffic of Stadium (LeetCode 601)
- 51.Game Play Analysis V (LeetCode 1097)
- 52.Premier League Table Ranking II (LeetCode 3252)
- 53.Change Null Values in a Table to the Previous Value (LeetCode 2388)
- 54.Count Artist Occurrences On Spotify Ranking List (LeetCode 2669)
- 55.Find Active Users (LeetCode 2688)
- 56.Customers with Maximum Number of Transactions on Consecutive Days (LeetCode 2752)
- 57.Flight Occupancy and Waitlist Analysis (LeetCode 2783)
- 58.Rolling Average Steps (LeetCode 2854)
- 59.Market Analysis III (LeetCode 2922)
- 60.Premier League Table Ranking III (LeetCode 3322)
- 61.Second Highest Salary II (LeetCode 3338)
- 62.Find Top Performing Driver (LeetCode 3308)
- 63.Viewers Turned Streamers (LeetCode 2995)
- 64.Seasonal Sales Analysis (LeetCode 3564)
- 65.Find Consistently Improving Employees (LeetCode 3580)
- 66.Find COVID Recovery Patients (LeetCode 3586)
- 67.Find Churn Risk Customers (LeetCode 3716)
- 68.Merge Overlapping Events in the Same Hall (LeetCode 2494)
- 69.User Activities within Time Bounds (LeetCode 3060)
- 70.Most Common Course Pairs (LeetCode 3764)
- 71.Find Emotionally Consistent Users (LeetCode 3808)
- 72.Find Users with Persistent Behavior Patterns (LeetCode 3832)