Skip to content

[FE]: Code challenge solution - Ngo Viet Anh#250

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

[FE]: Code challenge solution - Ngo Viet Anh#250
vietanh1606 wants to merge 3 commits into
99techteam:mainfrom
vietanh1606:main

Conversation

@vietanh1606
Copy link
Copy Markdown

This PR adds solutions for Problems 1, 2, and 3 of the code challenge.

Problem 1: Three Ways to Sum to N

  • Added three JavaScript implementations of sum_to_n.
  • Implemented using:
  • iterative loop
  • Gauss arithmetic formula
  • array reduce
  • Supports positive integers, zero, and negative integers.
  • Added README with implementation notes, complexity, and quick test examples.

Problem 2: Fancy Form

  • Built a currency swap form using Vite, React, and Tailwind CSS.
  • Fetches live token prices from the Switcheo price API.
  • Uses token icons from the Switcheo token icon repository.
  • Added custom token selector with icon and price display.
  • Calculates receive amount and exchange rate automatically.
  • Added validation for invalid amount, same-token swap, and insufficient balance.
  • Added mocked wallet balances and mocked swap submission loading state.
  • Added responsive, clean UI with blue accent styling.
  • Added README with run/build instructions and preview image placeholder.

Live Demo
https://fancy-form-steel.vercel.app/

Problem 3: Messy React

  • Added analysis of computational inefficiencies and anti-patterns in the provided React/TypeScript snippet.
  • Documented issues including:
  • missing type fields
  • incorrect filter logic
  • undefined variables
  • unstable sort comparator
  • incorrect useMemo dependencies
  • unused formatted data
  • index-based React keys
  • missing price fallback
  • Added a refactored TypeScript/React version.
  • Improved memoization by separating sorted balances from formatted balances.

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