Skip to content
Avio Lines
Q6

Window Functions

72 stations · 12h

ROW_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 →
problems by zone (pattern)
  • Top-N per group17
  • Consecutive rows / gaps & islands13
  • Running totals & moving averages7
  • Ranking20
  • Compare with previous / next row8
  • Other19
  1. Top-N per group

    0 of 17 passed
  2. Maximum Transaction Each DayLC 1831 · 13:14 · LeetCode Premium
    MediumLeetCode ↗ (opens in a new tab)
  3. Highest Grade For Each StudentLC 1112 · 7:34 · LeetCode Premium
    MediumGoogle · CourseraLeetCode ↗ (opens in a new tab)
  4. The Most Recent Three OrdersLC 1532 · 11:25 · LeetCode Premium
    MediumLeetCode ↗ (opens in a new tab)
  5. The Most Recent Orders for Each ProductLC 1549 · 10:16 · LeetCode Premium
    MediumAmazonLeetCode ↗ (opens in a new tab)
  6. Get the Second Most Recent ActivityLC 1369 · 10:26 · LeetCode Premium
    HardMicrosoftLeetCode ↗ (opens in a new tab)
  7. Longest Winning StreakLC 2173 · 14:50 · LeetCode Premium
    HardAmazonLeetCode ↗ (opens in a new tab)
  8. Find Longest CallsLC 3124 · 7:45 · LeetCode Premium
    MediumLeetCode ↗ (opens in a new tab)
  9. Top Percentile FraudLC 3055 · 6:41 · LeetCode Premium
    MediumLeetCode ↗ (opens in a new tab)
  10. Find Third TransactionLC 2986 · 9:21 · LeetCode Premium
    MediumCiscoLeetCode ↗ (opens in a new tab)
  11. Second Highest Salary IILC 3338 · 4:00 · LeetCode Premium
    MediumLeetCode ↗ (opens in a new tab)
  12. Find Top Performing DriverLC 3308 · 12:41 · LeetCode Premium
    MediumLeetCode ↗ (opens in a new tab)
  13. Consecutive rows / gaps & islands

    0 of 13 passed
  14. Consecutive NumbersLC 180 · 6:46
    MediumGoogle · Amazon · +7 more companiesLeetCode ↗ (opens in a new tab)
  15. Report Contiguous DatesLC 1225 · 12:26 · LeetCode Premium
    HardAmazon · MetaLeetCode ↗ (opens in a new tab)
  16. Active UsersLC 1454 · 9:36 · LeetCode Premium
    MediumcienaLeetCode ↗ (opens in a new tab)
  17. Longest Winning StreakLC 2173 · 14:50 · LeetCode Premium
    HardAmazonLeetCode ↗ (opens in a new tab)
  18. HardGoogle · Amazon · +4 more companiesLeetCode ↗ (opens in a new tab)
  19. Running totals & moving averages

    0 of 7 passed
  20. Restaurant GrowthLC 1321 · 10:24
    MediumGoogle · Amazon · +5 more companiesLeetCode ↗ (opens in a new tab)
  21. Year on Year Growth RateLC 3214 · 6:53 · LeetCode Premium
    HardAmazonLeetCode ↗ (opens in a new tab)
  22. Rolling Average StepsLC 2854 · 10:08 · LeetCode Premium
    MediumLeetCode ↗ (opens in a new tab)
  23. Ranking

    0 of 20 passed
  24. Rank ScoresLC 178 · 6:13
    MediumGoogle · Amazon · +5 more companiesLeetCode ↗ (opens in a new tab)
  25. The Change in Global RankingsLC 2175 · 16:04 · LeetCode Premium
    MediumLeetCode ↗ (opens in a new tab)
  26. Election ResultsLC 2820 · 7:08 · LeetCode Premium
    MediumLeetCode ↗ (opens in a new tab)
  27. Status of Flight TicketsLC 2793 · 6:20 · LeetCode Premium
    HardLeetCode ↗ (opens in a new tab)
  28. Longest Winning StreakLC 2173 · 14:50 · LeetCode Premium
    HardAmazonLeetCode ↗ (opens in a new tab)
  29. Find Longest CallsLC 3124 · 7:45 · LeetCode Premium
    MediumLeetCode ↗ (opens in a new tab)
  30. Top Percentile FraudLC 3055 · 6:41 · LeetCode Premium
    MediumLeetCode ↗ (opens in a new tab)
  31. Find Third TransactionLC 2986 · 9:21 · LeetCode Premium
    MediumCiscoLeetCode ↗ (opens in a new tab)
  32. Find Peak Calling Hours for Each CityLC 2984 · 5:49 · LeetCode Premium
    MediumDE ShawLeetCode ↗ (opens in a new tab)
  33. Game Play Analysis VLC 1097 · 8:10 · LeetCode Premium
    HardGSN GamesLeetCode ↗ (opens in a new tab)
  34. Market Analysis IIILC 2922 · 9:09 · LeetCode Premium
    MediumLeetCode ↗ (opens in a new tab)
  35. Viewers Turned StreamersLC 2995 · 6:32 · LeetCode Premium
    HardGoogle · PhonePeLeetCode ↗ (opens in a new tab)
  36. Compare with previous / next row

    0 of 8 passed
  37. The Change in Global RankingsLC 2175 · 16:04 · LeetCode Premium
    MediumLeetCode ↗ (opens in a new tab)
  38. Year on Year Growth RateLC 3214 · 6:53 · LeetCode Premium
    HardAmazonLeetCode ↗ (opens in a new tab)
  39. Find Active UsersLC 2688 · 5:28 · LeetCode Premium
    MediumLeetCode ↗ (opens in a new tab)
  40. Other

    0 of 19 passed
  41. Find the Team SizeLC 1303 · 7:56 · LeetCode Premium
    EasyAmazonLeetCode ↗ (opens in a new tab)
  42. Account BalanceLC 2066 · 8:58 · LeetCode Premium
    MediumLeetCode ↗ (opens in a new tab)
  43. Game Play Analysis IIILC 534 · 6:39 · LeetCode Premium
    MediumGSN GamesLeetCode ↗ (opens in a new tab)
  44. Project Employees IIILC 1077 · 8:27 · LeetCode Premium
    MediumMetaLeetCode ↗ (opens in a new tab)
  45. Biggest Window Between VisitsLC 1709 · 12:54 · LeetCode Premium
    MediumLeetCode ↗ (opens in a new tab)
  46. MediumGoogle · Amazon · +4 more companiesLeetCode ↗ (opens in a new tab)
  47. Arrange Table by GenderLC 2308 · 12:54 · LeetCode Premium
    MediumLeetCode ↗ (opens in a new tab)
  48. Group Employees of the Same SalaryLC 1875 · 8:13 · LeetCode Premium
    MediumClariLeetCode ↗ (opens in a new tab)
  49. Median Employee SalaryLC 569 · 10:25 · LeetCode Premium
    HardGoogle · AmazonLeetCode ↗ (opens in a new tab)
  50. Order Two Columns IndependentlyLC 2159 · 9:52 · LeetCode Premium
    MediumBooking.comLeetCode ↗ (opens in a new tab)
  51. Product Sales Analysis IVLC 2324 · 7:59 · LeetCode Premium
    MediumAmazonLeetCode ↗ (opens in a new tab)
  52. Find Interview CandidatesLC 1811 · 17:28 · LeetCode Premium
    MediumAmazonLeetCode ↗ (opens in a new tab)
  53. Suspicious Bank AccountsLC 1843 · 13:25 · LeetCode Premium
    MediumLeetCode ↗ (opens in a new tab)
  54. Find Expensive CitiesLC 2987 · 4:18 · LeetCode Premium
    EasyGoogleLeetCode ↗ (opens in a new tab)
  55. Market Analysis IILC 1159 · 11:24 · LeetCode Premium
    HardAmazon · PoshmarkLeetCode ↗ (opens in a new tab)

All 72 stations in order

  1. 1.Consecutive Available Seats (LeetCode 603)
  2. 2.Find the Team Size (LeetCode 1303)
  3. 3.Running Total for Different Genders (LeetCode 1308)
  4. 4.Find the Start and End Number of Continuous Ranges (LeetCode 1285)
  5. 5.Account Balance (LeetCode 2066)
  6. 6.The Most Frequently Ordered Products for Each Customer (LeetCode 1596)
  7. 7.Maximum Transaction Each Day (LeetCode 1831)
  8. 8.Game Play Analysis III (LeetCode 534)
  9. 9.Project Employees III (LeetCode 1077)
  10. 10.Biggest Window Between Visits (LeetCode 1709)
  11. 11.Last Person to Fit in the Bus (LeetCode 1204)
  12. 12.Highest Grade For Each Student (LeetCode 1112)
  13. 13.Restaurant Growth (LeetCode 1321)
  14. 14.The Most Recent Three Orders (LeetCode 1532)
  15. 15.Rank Scores (LeetCode 178)
  16. 16.The Change in Global Rankings (LeetCode 2175)
  17. 17.The Most Recent Orders for Each Product (LeetCode 1549)
  18. 18.Get the Second Most Recent Activity (LeetCode 1369)
  19. 19.Arrange Table by Gender (LeetCode 2308)
  20. 20.Group Employees of the Same Salary (LeetCode 1875)
  21. 21.The First Day of the Maximum Recorded Degree in Each City (LeetCode 2314)
  22. 22.Median Employee Salary (LeetCode 569)
  23. 23.Consecutive Numbers (LeetCode 180)
  24. 24.Order Two Columns Independently (LeetCode 2159)
  25. 25.Product Sales Analysis IV (LeetCode 2324)
  26. 26.Find Interview Candidates (LeetCode 1811)
  27. 27.Find the Quiet Students in All Exams (LeetCode 1412)
  28. 28.Suspicious Bank Accounts (LeetCode 1843)
  29. 29.All the Pairs With the Maximum Number of Common Followers (LeetCode 1951)
  30. 30.Report Contiguous Dates (LeetCode 1225)
  31. 31.Find Expensive Cities (LeetCode 2987)
  32. 32.Election Results (LeetCode 2820)
  33. 33.Status of Flight Tickets (LeetCode 2793)
  34. 34.Consecutive Available Seats II (LeetCode 3140)
  35. 35.Market Analysis II (LeetCode 1159)
  36. 36.Active Users (LeetCode 1454)
  37. 37.First and Last Call On the Same Day (LeetCode 1972)
  38. 38.Longest Winning Streak (LeetCode 2173)
  39. 39.Products With Three or More Orders in Two Consecutive Years (LeetCode 2292)
  40. 40.Compute the Rank as a Percentage (LeetCode 2346)
  41. 41.Customers With Strictly Increasing Purchases (LeetCode 2474)
  42. 42.Year on Year Growth Rate (LeetCode 3214)
  43. 43.Find Longest Calls (LeetCode 3124)
  44. 44.Top Percentile Fraud (LeetCode 3055)
  45. 45.Manager of the Largest Department (LeetCode 2988)
  46. 46.Find Third Transaction (LeetCode 2986)
  47. 47.Find Peak Calling Hours for Each City (LeetCode 2984)
  48. 48.Premier League Table Ranking (LeetCode 3246)
  49. 49.Find Cumulative Salary of an Employee (LeetCode 579)
  50. 50.Human Traffic of Stadium (LeetCode 601)
  51. 51.Game Play Analysis V (LeetCode 1097)
  52. 52.Premier League Table Ranking II (LeetCode 3252)
  53. 53.Change Null Values in a Table to the Previous Value (LeetCode 2388)
  54. 54.Count Artist Occurrences On Spotify Ranking List (LeetCode 2669)
  55. 55.Find Active Users (LeetCode 2688)
  56. 56.Customers with Maximum Number of Transactions on Consecutive Days (LeetCode 2752)
  57. 57.Flight Occupancy and Waitlist Analysis (LeetCode 2783)
  58. 58.Rolling Average Steps (LeetCode 2854)
  59. 59.Market Analysis III (LeetCode 2922)
  60. 60.Premier League Table Ranking III (LeetCode 3322)
  61. 61.Second Highest Salary II (LeetCode 3338)
  62. 62.Find Top Performing Driver (LeetCode 3308)
  63. 63.Viewers Turned Streamers (LeetCode 2995)
  64. 64.Seasonal Sales Analysis (LeetCode 3564)
  65. 65.Find Consistently Improving Employees (LeetCode 3580)
  66. 66.Find COVID Recovery Patients (LeetCode 3586)
  67. 67.Find Churn Risk Customers (LeetCode 3716)
  68. 68.Merge Overlapping Events in the Same Hall (LeetCode 2494)
  69. 69.User Activities within Time Bounds (LeetCode 3060)
  70. 70.Most Common Course Pairs (LeetCode 3764)
  71. 71.Find Emotionally Consistent Users (LeetCode 3808)
  72. 72.Find Users with Persistent Behavior Patterns (LeetCode 3832)