🧠 Don’t miss out! Get FREE access to my Skool community — packed with resources, tools, and support to help you with Data, Machine Learning, and AI Automations! 📈 https://www.skool.com/data-and-ai-aut...
In this tutorial, we walk through LeetCode 619: Biggest Single Number using both SQL and Python (Pandas). This is a great beginner-friendly problem that teaches you how to find values that appear only once—and return the largest among them.
LeetCode Question: https://leetcode.com/problems/biggest...
🚀 Hire me for Data Work: https://ryanandmattdatascience.com/da...
👨💻 Mentorships: https://ryanandmattdatascience.com/me...
📧 Email: ryannolandata@gmail.com
🌐 Website & Blog: https://ryanandmattdatascience.com/
🖥️ Discord: / discord
📚 *Practice SQL & Python Interview Questions: https://stratascratch.com/?via=ryan
📖 *SQL and Python Courses: https://datacamp.pxf.io/XYD7Qg
🍿 WATCH NEXT
LeetCode Playlist: • Leetcode Data Science Interview Questions
LeetCode 196: • LeetCode 196 - Delete Duplicate Emails (Py...
LeetCode 570: • LeetCode 570 - Managers With at Least 5 Di...
LeetCode 586: • LeetCode 586 Customer Placing the Largest ...
In this video, I walk you through solving LeetCode 619 - Biggest Single Number, a problem where you need to find the largest number that appears only once in a table. If no single number exists, the solution should return null. This is classified as an easy SQL problem, but I show you how to solve it in both SQL and Python Pandas, taking you step by step through each approach.
I start with the SQL solution, where I create a CTE to group numbers by their frequency using COUNT and GROUP BY. Then, I filter for numbers that appear exactly once and use the MAX function to grab the largest value, which automatically handles the null case if no single numbers exist. The SQL approach is clean and straightforward, making it perfect for beginners learning window functions and aggregation.
Next, I tackle the Python Pandas solution, which is significantly more challenging. I use groupby and size to count occurrences, filter for single numbers, sort values in descending order, and handle the edge case where no single number exists by creating a DataFrame with NaN. This solution demonstrates practical data manipulation skills that are essential for data analysts and data scientists working with Pandas.
By the end of this tutorial, you'll understand how to approach frequency-based problems in both SQL and Pandas, and you'll be able to confidently solve similar LeetCode questions on your own.
TIMESTAMPS
00:00 Problem Introduction
00:41 Example Walkthrough
01:13 SQL Solution - Building the CTE
02:04 SQL Solution - Final Query Explained
02:25 Python Pandas Solution Begins
03:28 Filtering and Sorting Data
04:10 Handling Null Cases
05:13 Solution Review and Recap
OTHER SOCIALS:
Ryan’s LinkedIn: / ryan-p-nolan
Matt’s LinkedIn: / matt-payne-ceo
Twitter/X: https://x.com/RyanMattDS
Who is Ryan
Ryan is a Data Scientist at a fintech company, where he focuses on fraud prevention in underwriting and risk. Before that, he worked as a Data Analyst at a tax software company. He holds a degree in Electrical Engineering from UCF.
Who is Matt
Matt is the founder of Width.ai, an AI and Machine Learning agency. Before starting his own company, he was a Machine Learning Engineer at Capital One.
*This is an affiliate program. We receive a small portion of the final sale at no extra cost to you.
In questa pagina del sito puoi guardare il video online LeetCode 619 -Biggest Single Number (Python and SQL) [Easy] della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Ryan & Matt Data Science 17 aprile 2024, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 389 volte e gli è piaciuto 16 spettatori. Buona visione!