Restaurant Growth — LeetCode 1321 Python Solution
MediumDatabase
- Problem
- #1321
- Reading time
- 2 min
- Source
- leetcode.com
Table schema
SQL
Table: Customer +---------------+---------+ | Column Name | Type | +---------------+---------+ | customer_id | int | | name | varchar | | visited_on | date | | amount | int | +---------------+---------+ In SQL,(customer_id, visited_on) is the primary key for this table. This table contains data about customer transactions in a restaurant.Example
SQL
+---------------+---------+
| Column Name | Type |
+---------------+---------+
| customer_id | int |
| name | varchar |
| visited_on | date |
| amount | int |
+---------------+---------+
In SQL,(customer_id, visited_on) is the primary key for this table.
This table contains data about customer transactions in a restaurant.
visited_on is the date on which the customer with ID (customer_id) has visited the restaurant.
amount is the total paid by a customer.Complexity
| Measure | Complexity |
|---|---|
| Time | O(n log n) (typical) |
| Space | O(n) auxiliary |
Related problems
Frequently asked questions
- How hard is LeetCode 1321. Restaurant Growth?
- LeetCode 1321. Restaurant Growth is rated Medium on LeetCode.
- What topics does LeetCode 1321. Restaurant Growth cover?
- LeetCode 1321. Restaurant Growth is tagged Database on LeetCode.