[Uber] OA 2025 Start – 14 Feb (Generic)

1. Matrix Gravity Drop Simulation

Given an m × n matrix where:

  • 'F' represents a target
  • '#' represents an obstacle
  • '-' represents empty space

The entire connected 'F' block will drop down due to gravity until:

  1. It reaches the bottom row.
  2. At least one 'F' touches an '#'.

Solution Approach

  1. Find all 'F' positions and determine the lowest row each column can move down to.
  2. Compute the minimum possible drop distance among all 'F'.
  3. Move all 'F' downward by that distance while preserving the structure.
  4. Return the final matrix state.

2. Flip Number Function

Given a number x, define flip(x) as:

  • Reverse digits while ignoring leading zeros in the result.

Examples:

  • flip(800) = 8
  • flip(210) = 12
  • flip(123) = 321

3. Count Valid Expressions in an Array

Given an array arr, count the number of valid pairs (i, j) where:

arr[i] + flip(arr[j]) = arr[j] + flip(arr[i])  

Solution Approach

  1. Rewrite the equation: arr[i] - flip(arr[i]) = arr[j] - flip(arr[j])
  2. Create a dictionary to store the count of each unique difference: diff = arr[i] - flip(arr[i])
  3. Iterate again and count occurrences of diff to determine valid pairs.
  4. Time Complexity: O(n).

我们长期稳定承接各大科技公司如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 *