Sobes.tech

Model a simple banking system: - `accounts` table: - `id`, - `owner_id`, - `currency`, - `created_at`. - `transactions` table: - `id`, - `account_id`, - `amount`, - `created_at`. **Requirements:** 1. Write SQL to create the schema with necessary constraints (NOT NULL, FK, CHECK on non-zero `amount`). 2. Write a query: - to get the current account balance by `account_id` (sum of amount). 3. Harder: support debit/credit (double entry). Cleanup

Middle+
170

Overall impression of the interview, candidate's level, recommendations

Middle+
156

How does the garbage collector work in Go? Describe the phases and algorithm.

Middle+
143

How can database search be optimized? What are indexes and what is their complexity?

Middle+
139

В чем преимущества goroutines перед OS threads?

Middle+
139

Tell us about the Go scheduler. How does it work? What is hand-off?

Middle+
134

What synchronization primitives are available in Go? What is the difference between Mutex and RWMutex? When to use atomics?

Middle+
120

How is the map in Go structured? Tell about its internal structure, buckets, collisions.

Middle+
100

3. Усложнение: поддержать дебет/кредит (двойная запись). Cleanup CREATE TABLE accounts ( id BIGSERIAL PRIMARY KEY, owner_id BIGINT NOT NULL, currency VARCHAR(3) NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT now() ); CREATE TABLE transactions ( id BIGSERIAL PRIMARY KEY, account_id BIGINT NOT NULL REFERENCES accounts(id), amount NUMERIC(18,2) NOT NULL CHECK (amount <> 0), created_at TIMESTAMP NOT NULL DEFAULT now() ); CREATE INDEX idx_transactions_account_id ON transactions(account_id); SELECT COALESCE(sum(amount), 0) AS balance FROM transactions WHERE account_id = :account_id; ALTER TABLE transactions ADD COLUMN type VARCHAR(6) NOT NULL CHECK (type IN ('debit', 'credit')); ALTER TABLE transactions DROP CONSTRAINT transactions_amount_check, ADD CONSTRAINT transactions_amount_check CHECK (amount > 0); SELECT COALESCE( SUM(CASE WHEN type = 'credit' THEN amount WHEN type = 'debit' THEN - amount ) AS balance FROM transactions WHERE account_id = :account_id;

Middle+
100

Model a simple banking system: - `accounts` table: - `id`, - `owner_id`, - `currency`, - `created_at`. - `transactions` table: - `id`, - `account_id`, - `amount`, - `created_at`. **Requirements:** 1. Write SQL to create the schema with necessary constraints (NOT NULL, FK, CHECK on non-zero `amount`). 2. Write a query: - to get the current account balance by `account_id` (sum of amount). 3. Harder: support debit/credit (double entry). Cleanup.

Middle+
81