Skip to content

FE Tech Solution#278

Open
himesh-dev wants to merge 3 commits into
99techteam:mainfrom
himesh-dev:main
Open

FE Tech Solution#278
himesh-dev wants to merge 3 commits into
99techteam:mainfrom
himesh-dev:main

Conversation

@himesh-dev
Copy link
Copy Markdown

PR Summary

Problem 1: Three Ways to Sum to N
The objective of this challenge was to provide three distinct functions that calculate the sum of all integers from one up to a given number n. To solve this, I implemented three fundamentally different programming approaches in JavaScript. The first approach leverages a mathematical formula, offering the most efficient and direct solution. The second uses a standard iterative loop to sequentially add each number, providing a reliable fallback. The final approach relies on recursion, breaking the problem down into smaller, self-calling segments to calculate the total.

Problem 2: Currency Swap Form
This task required the creation of a functional, user-friendly currency exchange form that fetches live token price data. My solution involved migrating the raw requirements into a fully modular React architecture with dedicated UI components. I engineered custom hooks to cleanly manage complex local state and separate the business logic from the presentation layer. To ensure top-tier performance, I integrated memoization techniques that prevent unnecessary component re-renders when interacting with the form. Finally, I improved overall accessibility by implementing full keyboard navigation support for the token selection dropdowns.

Problem 3: Refactoring Inefficient Wallet Code
For this challenge, I was tasked with identifying and fixing several computational inefficiencies, bugs, and anti-patterns within an existing React WalletPage component. I started by correcting flawed useMemo dependencies and broken sorting logic that failed to handle tie-breaker scenarios properly. Next, I eliminated a common React anti-pattern by swapping out array index keys for unique currency identifiers to guarantee stable rendering. To speed up execution, I replaced a heavy switch statement with an O(1) object lookup table and extracted it from the component lifecycle. Ultimately, these targeted refactors transform the widget into a secure, predictable, and highly performant component.

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