[Microsoft] FULLTIME ONLINE ASSESSMENT 16 Dec 2024

Given an array with integers, find the maximum sum of any 2 numbers whose first and last digits match.

E.g - [ 2, 36, 45, 306, 415] -> 36 + 306 < 45 + 415

Ans - 460

Example 1:

Input:  nums = [2, 36, 45, 306, 415]
Output: 460
Explanation: The maximum sum of any 2 numbers whose first and last digits match is obtained by adding 45 and 415, which gives us 460.

Given a 2D matrix with 2 rows and columns, containing only the characters 'R''W''?', give the minimum replacements of '?' required to make the matrix balanced.

The matrix would be balanced when it has equal number of 'W' and 'R' in all the rows and columns.

E.g. - R1 - "WR???"; R2 - "R???W" - Balanced - R1 - "WR?W", R2 - "RW?W"; 4 replacements

Example 1:

Input:  matrix = [['W', 'R', '?', '?', '?'], ['R', '?','?', '?', 'W']]
Output: 4
Explanation:
The given matrix can be balanced by making the following replacements:

Replace the first '?' in R1 with 'W' and the second '?' with 'R'.

Replace the first '?' in R2 with 'W' and the second '?' with 'R'.

This results in 4 replacements, making the matrix balanced with equal numbers of 'W' and 'R' in all rows and columns.
Microsoft
🔥 FULLTIME
ONLINE ASSESSMENT

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