OA VO support

Twitch TV OA real questions 2025 – Twitch codesignal OA 真题

Twitch的 OA 出奇的简单,但是目测也是白嫖OA,申请就发

Question 1: FizzBuzz

Description

Given a number n, return an array composed of the string representations of the numbers from 1 to n.
For multiples of 3, return the string "Fizz" instead of the number.
For multiples of 5, return the string "Buzz" instead of the number.
For multiples of both 3 and 5, return the string "FizzBuzz".


Example

For n = 15, the output should be:

solution(n) = ["1", "2", "Fizz", "4", "Buzz", "Fizz", "7", "8", "Fizz", "Buzz", "11", "Fizz", "13", "14", "FizzBuzz"]

Input/Output

  • [execution time limit]: 4 seconds (py3)
  • [memory limit]: 1 GB

Input:

  • integer n: A positive integer.

Guaranteed Constraints:

  • 1 ≤ n ≤ 10^5

Output:

  • array.string: Return an array of strings as described above.

Question 2: Replace Characters

Description

Given a string, replace each of its characters with the next one in the English alphabet (e.g., 'a' becomes 'b', 'z' becomes 'a').


Example

For inputString = "crazy", the output should be:

solution(inputString) = "dsbaz"

Input/Output

  • [execution time limit]: 4 seconds (py3)
  • [memory limit]: 1 GB

Input:

  • string inputString: A non-empty string consisting of lowercase English characters.

Guaranteed Constraints:

  • 1 ≤ inputString.length ≤ 1000

Output:

  • string: The resulting string after replacing each character.

Question 3: Add Binary Strings

Description

Given two binary strings a and b, add them together and return the resulting binary string.


Example

  1. For a = "1000" and b = "111", the output should be:
solution(a, b) = "1111"
  1. For a = "1" and b = "1", the output should be:
solution(a, b) = "10"

Input/Output

  • [execution time limit]: 4 seconds (py3)
  • [memory limit]: 1 GB

Input:

  1. string a: A string containing only the characters '0' and '1'.
  2. string b: A string containing only the characters '0' and '1'.

Guaranteed Constraints:

  • 0 ≤ a.length ≤ 10^5
  • 0 ≤ b.length ≤ 10^5

Output:

  • string: The result of adding the two binary strings, without any leading zeros.

Question 4: Closest Element in Array

Description

Given a sorted array of integers a, find the element x in a that minimizes the following sum:

abs(a[0] - x) + abs(a[1] - x) + ... + abs(a[a.length - 1] - x)

If there are multiple values of x that give the same minimum sum, return the smallest one.


Example

  1. For a = [2, 4, 7], the output should be:
solution(a) = 4

Explanation:

  • For x = 2, the value is abs(2 - 2) + abs(4 - 2) + abs(7 - 2) = 7.
  • For x = 4, the value is abs(2 - 4) + abs(4 - 4) + abs(7 - 4) = 5.
  • For x = 7, the value is abs(2 - 7) + abs(4 - 7) + abs(7 - 7) = 8.
  • The lowest value is achieved when x = 4.
  1. For a = [2, 3], the output should be:
solution(a) = 2

Explanation:

  • For x = 2, the value is abs(2 - 2) + abs(3 - 2) = 1.
  • For x = 3, the value is abs(2 - 3) + abs(3 - 3) = 1.
  • Since there is a tie, the smallest value of x is returned.

Input/Output

  • [execution time limit]: 4 seconds (py3)
  • [memory limit]: 1 GB

Input:

  • array.integer a: A non-empty array of integers, sorted in ascending order.

Guaranteed Constraints:

  • 1 ≤ a.length ≤ 1000
  • -10^5 ≤ a[i] ≤ 10^5

Output:

  • integer: The element of a that minimizes the sum.

Question 5: Group by Mean Value

Description

You are given an array of arrays a. Your task is to group the arrays by their mean values, so arrays with the same mean values are in the same group, and arrays with different mean values are in different groups. Each group should contain the indices (i, j, etc) of the corresponding arrays. Return the groups as an array of arrays, where the indices within each group are sorted in ascending order, and the groups are sorted by their minimum element.


Input/Output

  • [execution time limit]: 4 seconds (py3)
  • [memory limit]: 1 GB

Input:

  • array.array.integer a: An array of arrays of integers.

Guaranteed Constraints:

  • Each sub-array is non-empty.
  • 1 ≤ a.length ≤ 100
  • 1 ≤ a[i].length ≤ 100
  • -10^5 ≤ a[i][j] ≤ 10^5

Output:

  • array.array.integer: The grouped indices sorted as described above.

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