[uber] OA 2025 start – 28 Apr (general)

1. Number Puzzle

Complete the blanks in the following question with the appropriate answer.

What is the number closest to 2024 such that:

  • when divided by 2 leaves a remainder of 1,
  • when divided by 3 leaves a remainder of 2,
  • when divided by 4 leaves a remainder of 3,
  • when divided by 5 leaves a remainder of 4,
  • when divided by 6 leaves a remainder of 5,
  • and is divisible by 7?

2. Cut Square Chocolate

Complete the blanks in the following question with the appropriate answer.

How many distinct ways are there to cut a 4×4 piece of chocolate into squares with integer sides, considering ways of cutting that differ by a rotation and/or a reflection as distinct? For example:

  • a 2×2 chocolate and five 1×1 chocolates; and
  • nine 1×1 chocolates.

14. Pandas

An order list contains information on goods to be received and sold each day. (The dataset might not be in chronological order). Each day, there may be multiple entries on goods received and goods sold. Each entry indicates the unique sizes of the goods received/sold. If the supply (goods received) is unable to meet the demand (goods sold), we say the demand is not met for that day, and vice versa. The order list is "Possible" if demand can be met for each day in the order list. Else, the order list is "Not Possible".

The task is to determine if an order list is "Possible" or "Not Possible".

The given pandas dataframe consists of four columns:

  • id - unique id
  • date_added - date when the record was added (YYYY-MM-DD)
  • type - whether the goods are "Received" or "Sold"
  • sizes - different sizes in which the goods are available each separated by '/'

Example

Consider, for example, you are given the following dataframe:

iddate_addedtypesizes
12016-02-01Received7/8/9
22016-02-01Sold8/9
32016-03-01Received36/37

16. River Records

A meteorologist maintains a record of water level readings taken on a nearby river. One of the figures to determine is the maximum height above a previously recorded value that has been achieved to date. Given an array of integers, find the maximum difference between any element and any preceding smaller element without changing the order. If there is no such preceding element, return -1.

Example

arr = [5, 3, 6, 7, 4]
  • There is one lower earlier reading with a lower value than arr[0] = 5.
  • There is one lower earlier reading with a value lower than arr[1].
  • There are two lower earlier readings with a value lower than arr[2] = 6:
    • arr[2] - arr[1] = 6 - 3 = 3
    • arr[2] - arr[0] = 6 - 5 = 1
  • There are three lower earlier readings with a value lower than arr[3] = 7:
    • arr[3] - arr[2] = 7 - 6 = 1
    • arr[3] - arr[1] = 7 - 3 = 4
    • arr[3] - arr[0] = 7 - 5 = 2
  • There is one lower earlier reading with a value lower than arr[4] = 4:
    • arr[4] - arr[1] = 4 - 3 = 1

The maximum trailing record is arr[3] - arr[1] = 4.


17. Minimum Cost

There are n points on the x-axis (1, 2, 3, ..., n), where the i-th point has a cost associated denoted by cost[i].

Starting from coordinate x = 0, jumps of length k can be taken. Wherever a stop is made, the cost of that point is incurred. Find the minimum cost to reach the point n taking jumps of length at most k.

Example

Consider n = 5, cost = [4, 3, 9, 3, 1], and k = 2.

The optimal jump pattern is:

  • jump from 0 → 1 → 2 → 4 → 5
  • the cost of stopping at point 1 is 4
  • the cost of stopping at point 2 is 3
  • the cost of stopping at point 5 is 1
  • total cost = 4 + 3 + 1 = 8

But better pattern:

  • jump from 0 → 1 → 3 → 5
  • the cost is 4 + 9 + 1 = 14

Best is:

  • 0 → 1 → 2 → 3 → 5 with costs 4 + 3 + 3 + 1 = 11

Thus the minimum possible is 7.

Function Description

Complete the function getMinimumCost in the editor below.

def getMinimumCost(cost: List[int], k: int) -> int:
    # Returns the minimum total cost incurred to reach point n

Constraints:

  • Inputs are list cost and integer k.
  • Output is a long integer representing the minimum cost.

我们长期稳定承接各大科技公司如TikTok、Google、Amazon等的OA笔试代写服务,确保满分通过。如有需求,请随时联系我们。

We consistently provide professional online assessment services for major tech companies like TikTok, Google, and Amazon, guaranteeing perfect scores. Feel free to contact us if you're interested.

Leave a Reply

Your email address will not be published. Required fields are marked *