Google 90 minutes OA – 谷歌 90分钟OA真题解密 – OA代写 – 面试代面

Ready to code?

90 minutes for 2 questions

The assessment, which includes both the coding exercise and the Snapshot survey, helps determine if you possess competencies and characteristics needed to be successful in this role at Google.

The result of the assessment is an automated standardized score (pass/fail), and each submission will undergo an automated cheating detection review. You need to receive a passing score to proceed with the Google hiring process. A passing score will be valid for 24 months after taking the assessment if you choose to apply for the same or another role at Google that requires you to take the assessment. If you fail, you can retake the assessment for the same role in 6 months’ time. Please ensure your submission is entirely your own, without using any outside sources, including generative AI tools. Use of such sources or tools is considered to be cheating. If cheating is detected, you will be removed from the hiring process and not eligible to be considered for any role at Google for one year.

To protect your privacy, your answers to individual questions are not shared with anyone involved in your hiring process. Those involved in your hiring process will only see the assessment outcome (pass/fail). Our research team may also use your assessment data to conduct ongoing research to improve our hiring process.


Question One

You are given an array A of N integers. You can split the array into two non-empty parts, left and right, sort the elements in each part independently, and join them back together.

For example, given array A = [1, 3, 2, 4], you can split it in the following three ways:

  1. Left = [1], Right = [3, 2, 4]. Sorting the elements and joining the parts back together results in the array: [1, 2, 3, 4].
  2. Left = [1, 3], Right = [2, 4]. Resulting sorted and rejoined array: [1, 3, 2, 4].

Your task is to find the number of ways of splitting the array into two parts such that, after sorting the two parts and rejoining them into a single array, the resulting array will be sorted in non-decreasing order.

Write a function:

class Solution {
public int solution(int[] A);
}

which, given an array A of length N, returns the number of different ways of obtaining a sorted array by applying the procedure described above.


Question Two

There is an array A consisting of N integers. Choose at most one element to multiply by -1 in order to obtain an array whose sum of elements is as close to 0 as possible. That is, find the sum with the minimum absolute value.

Write a function:

int solution(vector<int> &A);

that, given an array A, returns the minimum absolute value of the sum of A that can be obtained.

Examples:

  1. For A = [1, 3, 2, 5], after multiplying the last element by -1, A will be equal to [1, 3, 2, -5]. Its sum is 1. The function should return 1.
  2. For A = [-4, 0, -3, -3], multiply -4 by -1 to obtain [4, 0, -3, -3], and the sum is -2. The function should return 2.

Write an efficient algorithm for the following assumptions:

  • N is an integer within the range [1..100,000];
  • Each element of array A is an integer within the range [-1,000..1,000].

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