CS-OA cs-vo Faang

IBM SWE OA – OA 代写 – Closest Numbers – Largest Number – 面试辅助 – 面试代面 – 一亩三分地

Problem 1: Closest Numbers

Description: Given an array of distinct integers, determine the minimum absolute difference between any two elements. Then, print all element pairs with that difference in ascending order.

Example: Input: numbers = [6, 2, 4, 10] Output: The minimum absolute difference is 2. The pairs with that difference are (2,4) and (4,6). The pairs should be ordered first by the first element and then by the second.

Function Description: Complete the function closestNumbers.

  • Parameters:
    • int numbers[]: an array of integers
  • Returns:
    • None (the function prints the pairs directly)

Problem 2: Get Largest Number

Description: Given a string representing a number, you can swap two adjacent digits if they are of the same parity (both odd or both even). Find the largest number that can be created using any number of swaps.

Example: Input: num = "7596801" Steps:

  • Swap 5 and 9 -> "7956801"
  • Swap 7 and 9 -> "9756801"
  • Swap 6 and 8 -> "9758601" Output: The largest value possible is "9758601".

Function Description: Complete the function getLargestNumber.

  • Parameters:
    • string num: a string of digits
  • Returns:
    • string: the largest number that can be created

我们提供OA代写服务,代面试服务,面试辅助服务等。对于OA代写我们将确保你获得满分,联系我们立即进行预约。

We provide services for writing online assessments (OA), proxy interviews, and interview assistance. For the OA writing service, we will ensure that you achieve a perfect score. Contact us now to make an appointment.

Leave a Reply

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