Solve remembered OA coding tasks
Problem Description
This assessment consists of three distinct coding challenges. Candidates are expected to provide efficient and correct solutions for each.
Challenge 1: Top Three Companies by Average Stock Price
Given a mapping where each company name is associated with a list of its daily stock prices, compute the average stock price for every company. From these averages, identify and return the names of the three companies with the highest average stock price. If fewer than three companies are provided, return all available companies. In cases where two companies have identical average stock prices, ties should be broken by sorting company names in ascending lexicographical order.
Challenge 2: Bounding Rectangle of 2D Points
Given a list of 2D coordinates, [(x1, y1), (x2, y2), ..., (xn, yn)], determine the smallest axis-aligned rectangle that encompasses all these points. The required output consists of four values:
- The minimum x-coordinate (
min_x) among all points. - The minimum y-coordinate (
min_y) among all points. - The width of the bounding rectangle, calculated as
max_x - min_x. - The height of the bounding rectangle, calculated as
max_y - min_y.
Challenge 3: Validate a Partially Filled 9x9 Number Board
You are provided with a 9x9 grid representing a partially filled number board. Each cell in the grid contains either a digit from '1' to '9' or a period '.' to denote an empty cell. Your task is to determine if the current state of this board is valid according to the following rules:
- No digit (from '1' to '9') may appear more than once within any single row.
- No digit (from '1' to '9') may appear more than once within any single column.
- No digit (from '1' to '9') may appear more than once within any of the nine 3x3 subgrids. Empty cells ('.') do not violate any rules.
AI interview prep
Core dilemma
Balancing efficient data processing and algorithmic correctness across diverse problem types, while demonstrating robust handling of edge cases and clear, maintainable code structure.
3 tradeoffs and 3 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Solve remembered OA coding tasks
Problem Description
This assessment consists of three distinct coding challenges. Candidates are expected to provide efficient and correct solutions for each.
Challenge 1: Top Three Companies by Average Stock Price
Given a mapping where each company name is associated with a list of its daily stock prices, compute the average stock price for every company. From these averages, identify and return the names of the three companies with the highest average stock price. If fewer than three companies are provided, return all available companies. In cases where two companies have identical average stock prices, ties should be broken by sorting company names in ascending lexicographical order.
Challenge 2: Bounding Rectangle of 2D Points
Given a list of 2D coordinates, [(x1, y1), (x2, y2), ..., (xn, yn)], determine the smallest axis-aligned rectangle that encompasses all these points. The required output consists of four values:
- The minimum x-coordinate (
min_x) among all points. - The minimum y-coordinate (
min_y) among all points. - The width of the bounding rectangle, calculated as
max_x - min_x. - The height of the bounding rectangle, calculated as
max_y - min_y.
Challenge 3: Validate a Partially Filled 9x9 Number Board
You are provided with a 9x9 grid representing a partially filled number board. Each cell in the grid contains either a digit from '1' to '9' or a period '.' to denote an empty cell. Your task is to determine if the current state of this board is valid according to the following rules:
- No digit (from '1' to '9') may appear more than once within any single row.
- No digit (from '1' to '9') may appear more than once within any single column.
- No digit (from '1' to '9') may appear more than once within any of the nine 3x3 subgrids. Empty cells ('.') do not violate any rules.