3530. Odd and Even Transactions
My accepted SQL solution to LeetCode problem 3530, Odd and Even Transactions, running in 257ms.
- Difficulty: Medium
- SQL
- Runtime 257ms
- Memory 0.0B
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
SQL
Accepted on LeetCode — runtime 257ms, memory 0.0B, accepted 2026-01-02.
SELECT
transaction_date,
SUM(CASE WHEN amount % 2 = 1 THEN amount ELSE 0 END) AS odd_sum,
SUM(CASE WHEN amount % 2 = 0 THEN amount ELSE 0 END) AS even_sum
FROM transactions
GROUP BY transaction_date
ORDER BY transaction_date