1). Biggest Single Number and 2). Find Followers Count SQL MySQL leetcode solution
Challenge: Counting User Followers
Difficulty: Easy
Data:
A table named Followers stores information about user followings in a social media application:
user_id (int): Unique identifier for a user. (Primary Key along with follower_id)
follower_id (int): Unique identifier for a user who follows another user (user_id).
Objective:
Calculate the number of followers for each user in the social media application.
Output:
A table with two columns:
user_id (int): Unique identifier for a user (same as input table).
followers_count (int): Number of followers this user has.
Explanation:
We need to count the occurrences of each distinct user_id in the follower_id column of the Followers table. This represents the number of users following each user (user_id).
Challenge: Finding the Largest Unique Number
Difficulty: Easy
Data:
A table named MyNumbers stores a collection of integer values:
num (int): An integer value. (No primary key)
Objective:
Find the largest integer value that appears only once (unique) in the MyNumbers table. If no unique numbers exist, return null.
Output:
A table with a single column:
num (int): The largest unique integer value in the table, or null if there are no unique values.
Explanation:
We need to identify the maximum value from the MyNumbers table that has a count of one (appears only once). If no such value exists, return null.