Solve remembered OA coding tasks
UpstartSoftware Engineer · Online AssessmentLast updated
This set of problems evaluates skills in data aggregation and ordering (identifying top averages), computational geometry and extrema calculation (axis-aligned bounding rectangle), and grid constraint validation and consistency checking (partially filled 9x9 number board).
The online assessment reportedly had five coding questions, but only the following three were described clearly enough to reconstruct:
-
Find the top three companies by average stock price You are given a mapping from company name to a list of its daily stock prices over several days. Compute the average stock price for each company and return the names of the three companies with the highest average price. If there are fewer than three companies, return all of them. If two companies have the same average, break ties by company name in ascending lexicographic order.
-
Compute the bounding rectangle of a set of points You are given a list of 2D coordinates
[(x1, y1), (x2, y2), ..., (xn, yn)]. Return four values:
- the minimum
xvalue, - the minimum
yvalue, max_x - min_x,max_y - min_y.
In other words, return the lower-left corner, width, and height of the smallest axis-aligned rectangle that contains all points.
- Validate a partially filled 9x9 number board
You are given a 9x9 grid where each cell contains either a digit
'1'through'9'or'.'for empty. Determine whether the current board state is valid under these rules:
- no digit may appear more than once in any row,
- no digit may appear more than once in any column,
- no digit may appear more than once in any 3x3 subgrid.
The other two OA questions were not described clearly enough to reconstruct.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.