From d8c5c7cea1e03e44d5ec2f4536c388c06d7a241b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Antonio=20Chac=C3=B3n=20Guti=C3=A9rrez?= <138903866+joseantoniochacon@users.noreply.github.com> Date: Wed, 26 Jun 2024 13:49:24 -0600 Subject: [PATCH] Create README - LeetHub --- .../README.md | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 0586-customer-placing-the-largest-number-of-orders/README.md diff --git a/0586-customer-placing-the-largest-number-of-orders/README.md b/0586-customer-placing-the-largest-number-of-orders/README.md new file mode 100644 index 0000000..9e44468 --- /dev/null +++ b/0586-customer-placing-the-largest-number-of-orders/README.md @@ -0,0 +1,47 @@ +
Table: Orders
+-----------------+----------+ +| Column Name | Type | ++-----------------+----------+ +| order_number | int | +| customer_number | int | ++-----------------+----------+ +order_number is the primary key (column with unique values) for this table. +This table contains information about the order ID and the customer ID. ++ +
+ +
Write a solution to find the customer_number
for the customer who has placed the largest number of orders.
The test cases are generated so that exactly one customer will have placed more orders than any other customer.
+ +The result format is in the following example.
+ ++
Example 1:
+ +Input: +Orders table: ++--------------+-----------------+ +| order_number | customer_number | ++--------------+-----------------+ +| 1 | 1 | +| 2 | 2 | +| 3 | 3 | +| 4 | 3 | ++--------------+-----------------+ +Output: ++-----------------+ +| customer_number | ++-----------------+ +| 3 | ++-----------------+ +Explanation: +The customer with number 3 has two orders, which is greater than either customer 1 or 2 because each of them only has one order. +So the result is customer_number 3. ++ +
+
Follow up: What if more than one customer has the largest number of orders, can you find all the customer_number
in this case?