Find Min Price
Reported by candidates from Paypal's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
You've got a Paypal OA in your inbox from November 2024, and the problem is Find Min Price. This is a classic optimization problem that looks deceptively simple at first. You're likely working with a list of prices and need to extract the minimum value, but the catch is almost always in the edge cases or the data structure you're iterating through. Paypal's assessments tend to layer constraints that make a straightforward min() call insufficient. StealthCoder can read the exact problem text during your assessment and feed you the pattern in real time if you blank on approach.
Pattern and pitfall
The core pattern here is likely array-based or hash-table based depending on how prices are stored. You'll iterate through the dataset once, tracking the minimum value as you go. The trick Paypal probably tests: are the prices in a flat array, or nested in objects or a dictionary keyed by product ID. Are there invalid prices (null, zero, negative) you need to filter. Is there a time constraint where you need to find min price across multiple time windows. The algorithmic cost is O(n) time and O(1) space for a straightforward scan. Don't overthink it. If you blank mid-interview, StealthCoder will show you exactly what data structure you're working with and whether you need to sort, filter, or just scan once. That clarity alone saves you 5-10 minutes of second-guessing.
The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.
You can drill Find Min Price cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Paypal's OA.
Paypal reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Find Min Price FAQ
Is this just a min() call or is there a twist?+
Paypal usually embeds the twist in data structure. Prices might be nested, have invalid entries, or be keyed by product name. Read the input format carefully. The algorithm is still O(n), but you'll lose points if you assume a flat array when the data is a dictionary.
Do I need to handle negative or zero prices?+
Almost certainly yes. Expect the problem to include invalid or edge case prices. Add a filter step before you scan for min. Check the problem statement for what counts as a valid price. That one detail can make or break your solution.
Should I sort the array first?+
No. Sorting is O(n log n) and unnecessary. You'll scan once, track the minimum, and you're done in O(n). Sorting signals you didn't understand the problem. Stay linear.
What if there are no valid prices in the input?+
Return null, -1, or raise an exception, depending on the problem spec. This is an edge case Paypal cares about. Read what the expected output should be for an empty or all-invalid input before you code.
How do I prep in 48 hours if I blank during the OA?+
Don't cram algorithm books. Focus on reading the problem statement three times: once for understanding, once for edge cases, once for data structure shape. That clarity is 80% of the work. StealthCoder bridges the gap if panic hits and you need the pattern spelled out.