Skip to content

[BE] Hung Pham#284

Open
tienhung278 wants to merge 3 commits into
99techteam:mainfrom
tienhung278:main
Open

[BE] Hung Pham#284
tienhung278 wants to merge 3 commits into
99techteam:mainfrom
tienhung278:main

Conversation

@tienhung278

Copy link
Copy Markdown

Problem 4: Three Ways to Sum to N

Description:
Provides three distinct implementations of a function that computes the summation from 1 to n:

  • sum_to_n_a — Uses Gauss's formula n*(n+1)/2. O(1) time, O(1) space.
  • sum_to_n_b — Iterative approach with a for-loop accumulator. O(n) time, O(1) space.
  • sum_to_n_c — Recursive approach. O(n) time, O(n) space (call stack).

Each function includes inline comments documenting its time and space complexity trade-offs.


Problem 5: Todo CRUD API (Express.js + TypeScript)

Description:
A fully functional Express.js API written in TypeScript implementing all five CRUD operations for a Todo resource:

  • Create (POST /todos) — Validates input, generates UUID, sets timestamps.
  • List (GET /todos) — Supports filtering by completed status, text search, and pagination (limit/offset).
  • Get Details (GET /todos/:id) — Returns a single todo or 404.
  • Update (PUT /todos/:id) — Partial update with automatic updatedAt timestamp.
  • Delete (DELETE /todos/:id) — Removes a todo by ID.

Architecture follows a layered pattern (Routes → Controllers → Services → Repositories) with:

  • Repository interface for swappable data storage (currently JSON file-based)
  • Custom error classes + global error handler middleware
  • Constructor-based dependency injection
  • Centralized configuration

Problem 6: Scoreboard Module Specification

Description:
A comprehensive technical specification document for a live-updating scoreboard system, intended as a blueprint for backend engineers. Includes:

  • System architecture diagram — Full request flow from client through auth, rate limiting, controller, service, database, cache, and WebSocket broadcast.
  • Execution flow diagrams — For score updates, scoreboard retrieval, and WebSocket connections.
  • API endpoint specsPOST /scores/action, GET /scores/top, GET /scores/me with request/response schemas.
  • Database schema — Users, scores, and action_logs tables with indexes.
  • Security measures — JWT authentication, per-user rate limiting, idempotency keys, HMAC-signed action payloads.
  • Technology stack recommendations — Node.js, Redis sorted sets, PostgreSQL, Socket.io.
  • Improvement suggestions — Horizontal scaling, anomaly detection, action verification queues, batch processing, graceful degradation, and testing strategy.

@tienhung278 tienhung278 changed the title [BE] Code Challenge - Hung Pham [BE] Hung Pham Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant