Write a quarterly SQL report and a bash max-file script
Part A — SQL (conditional aggregation)
You have two tables:
coins(coin_id, name)transactions(id, coin_id, dt, amount)
Write a query that returns one row per coin with the following columns:
nameq1_amount,q2_amount,q3_amount,q4_amount(sum ofamountfor transactions whosedtfalls in quarter 1/2/3/4)total_transactions(count of transactions for that coin)total_amount(sum ofamountfor that coin)
Assume all transactions are within the same calendar year; if multiple years exist, state how you would filter to a target year.
Part B — Bash (filesystem)
Given a directory path, implement a shell function that returns the maximum file size (bytes) among all regular files under that directory.
Clarify whether the search is recursive; if not specified, assume recursive (include subdirectories). Handle the empty-directory case sensibly (e.g., return 0 or no output) and avoid counting directories.
AI interview prep
Core dilemma
For Part A, the core dilemma is efficiently aggregating transactional data across different time granularities (quarters) while also providing summary statistics. For Part B, it's about robustly traversing a file system and identifying specific file properties under potentially complex directory structures and edge cases.
3 tradeoffs and 3 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Write a quarterly SQL report and a bash max-file script
Part A — SQL (conditional aggregation)
You have two tables:
coins(coin_id, name)transactions(id, coin_id, dt, amount)
Write a query that returns one row per coin with the following columns:
nameq1_amount,q2_amount,q3_amount,q4_amount(sum ofamountfor transactions whosedtfalls in quarter 1/2/3/4)total_transactions(count of transactions for that coin)total_amount(sum ofamountfor that coin)
Assume all transactions are within the same calendar year; if multiple years exist, state how you would filter to a target year.
Part B — Bash (filesystem)
Given a directory path, implement a shell function that returns the maximum file size (bytes) among all regular files under that directory.
Clarify whether the search is recursive; if not specified, assume recursive (include subdirectories). Handle the empty-directory case sensibly (e.g., return 0 or no output) and avoid counting directories.