Back to Browse

First Order Logic: SQL Window Functions vs Pandas drop_duplicates() | LeetCode 1174

2 views
May 22, 2026
7:03

In this video, we tackle LeetCode 1174 (Immediate Food Delivery II) using BOTH MS SQL Server and Python Pandas. This problem requires a two-step approach: first, isolate the absolute first order for every single customer, and second, calculate the exact percentage of those orders that were immediate vs. scheduled. What you'll learn in this walkthrough: - SQL Strategy: Using ROW_NUMBER() to identify first orders and a clever AVG(CASE WHEN...) trick to calculate percentages without integer truncation. - Pandas Strategy: Leveraging .sort_values() with .drop_duplicates(keep='first') to clean the data, followed by rapid boolean averaging using .mean(). - Interview Tips: How to handle decimal accuracy and formatting (rounding to 2 decimal places). ⏱️ Timestamps: 0:00 - Intro 1:22 - SQL Solution 4:31 - Python Pandas Solution Check out similar logic solving another problem: https://youtu.be/GhUn-B5BIbg Check out my Playlist: https://www.youtube.com/playlist?list=PLGT-z9cVth9mua-HvnqhN2FQTisyZjQ4B If you find these side-by-side comparisons helpful, don't forget to Like, Comment, and Subscribe! #leetcode #sql #pandas #python #dataengineering #datascience #codinginterview

Download

0 formats

No download links available.

First Order Logic: SQL Window Functions vs Pandas drop_duplicates() | LeetCode 1174 | NatokHD