← Questions
Searchable transaction list that highlights the largest
0
I was asked this
No reports yet. Sign in to say where you were asked it.
A coding interview question asked in Stripe's HackerRank assessment, last asked Sep 2025. It tests react, frontend and filtering.
Build a small UI component that takes a list of transactions {name: string, amount: number}[], renders them, lets the user filter them, and highlights the largest transaction among those currently shown.
What to build
- Render the list of transactions.
- Filter it: a search box that matches names case-insensitively by substring, and a numeric "minimum amount" filter.
- Highlight the maximum: within the filtered list, highlight the name of every transaction with the largest amount (all of them on a tie). The highlight updates as the filters change. When nothing matches, show a clear empty state and no highlight.
Example
data = [{name: "Coffee", amount: 4.5}, {name: "Rent", amount: 1800},
{name: "Concert", amount: 120}, {name: "Car repair", amount: 1800}]
no filter -> all four shown; "Rent" and "Car repair" highlighted
search "co" -> Coffee, Concert; "Concert" highlighted
search "co", min 5 -> Concert; highlighted
search "xyz" -> "No transactions match", nothing highlighted
Clarifying questions
- Is this React, another framework or plain DOM? Can I use any library?
- Should the filters live in the URL or local state?
- How large can the list get?
- Does the search trim whitespace and handle accents and non-ASCII names?
What a strong answer covers
- State that holds only the inputs (the data and the two filter values); the filtered list and the maximum are derived on render, memoized if needed.
- One pass over the filtered list to find the maximum: O(n) per change.
- Stable keys for list items, an accessible search input with a label, and an empty state.
- How you would test it: empty input, ties, a filter that removes the maximum, non-ASCII names, rapid typing.
Follow-ups
- The list has 100,000 items. Debounce the search and virtualize the list.
- Sort by amount or name, and keep the highlight correct.
- Highlight the matched part of each name.
Where it's asked
- Stripe · HackerRank assessment · Last asked Sep 2025Leveled HackerRank task; test cases map to the parts in order
What it tests
react · frontend · filtering
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
