CS-OA cs-vo Faang

Microsoft invites you to take a programming test – OA 代写 – 面试代面 –

110 minutes for 2 tasks

Important Notes from Microsoft:

  • As professionals, we expect you will not copy and paste from other sources or plagiarize your answers from the internet. Codility validates all candidate solutions for similar solutions and will flag those answers directly to Microsoft.
  • Attention to detail is key! Make sure to read the questions thoroughly and address ALL components.

Before you begin

  1. There are 2 tasks in the test. You can solve them in any order.
  2. There’s no option to pause. Make sure you will not be interrupted for 110 minutes.
  3. Your solution(s) should consider all possible corner cases and handle large input efficiently. Passing the example test does not indicate that your solution is correct. The example test is not part of your final score.
  4. If you accidentally close your browser, use the invitation link to get back to your test.
  5. Hint: You can use your own IDE and use copy-paste, but make sure your solution compiles in Codility’s environment.

You can write your solution(s) in any of the following languages:

  • C, C#, C++, C++20, Dart, Go, Java 11, Java 8, JavaScript, Kotlin, Lua, Objective-C, PHP, Pascal, Perl, Python, Ruby, Rust, Scala, Swift, TypeScript, or Visual Basic.

Task 1:

Today our world is approaching an ecological crisis.

Due to global warming, sea levels are rising, and the amount of drinkable water is decreasing. One idea about preventing the loss of drinkable water is the propagation of rainwater storage, equipping houses with water tanks to collect rainwater.

  • You are given a string S describing a street in which 'H' denotes a house and '-' denotes an empty plot.
  • Your task is to find the minimum number of water tanks needed to collect rainwater from all the houses.

Write a function:

def solution(S):

Examples:

  1. Given S = "-H-HH--", the function should return 2.
  1. Given S = "H", the function should return -1.

Task 2:

There are N points on a plane, numbered from 0 to N-1.

The coordinates of the K-th point are (X[K], Y[K]). Find any triangle with vertices at three of the given points, such that no other point lies inside this triangle. The triangle must have a positive area.

Write a function:

def solution(X, Y):

Example:

Given X = [1, 4, 3, 2, 3] and Y = [4, 3, 1, 1, 2], the output should be an array with indices that form a valid triangle.

The function could return [0, 1, 4], since points 0, 1, and 4 form an empty triangle. Answer [0, 1, 2] would be incorrect, since triangle 0, 1, 2 contains point 4 inside. Answer [0, 1, 3] would be incorrect, since triangle 0, 1, 3 contains point 4 on the boundary. Answer [1, 3, 4] would be incorrect, since 1, 3, and 4 do not form a triangle with positive area. Answer [4, 2, 3] would be considered correct, since points 2, 3, and 4 also form an empty triangle.

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