Roblox Entry Level OA

Title: "Calculate Mention Statistics in a Group Chat"

Problem Statement
Imagine there is a group chat with many users writing messages. The content of messages includes text and mentions of other users in the chat. Mentions in the group chat are formatted as strings starting with the @ character and followed by at least one ID separated by commas. An ID is formatted as a string starting with id and followed by a positive integer from 1 to 999.

For example:

  • "This is an example with no mentions@"
  • "This is an example with @id1 one mention of one user"
  • "This is an example with @id1,id123,id983 one mention of three users"
  • "This is an example with @id1,id123,id983 several mentions of several users @id239"

Now, imagine you are given two arrays of strings titled members and messages. Your task is to calculate the mention statistics for the group chat. In other words, count the number of messages that each chat member is mentioned in. Chat members mentioned multiple times in a message should be counted only once per message.

Output Format
Return the mention statistics in an array of strings, where each string follows this format:
[user id]=[mentions count].

The array should be sorted by mention count in descending order, or in case of a tie, lexicographically by user id in ascending order.

Constraints and Notes

  • Proper IDs will always be used for each mention.
  • All mentions will be preceded by and followed by a space, unless they are located at the beginning or end of the message.
  • The @ character is still allowed in a message but not as part of any mention (e.g., it cannot be the first character in a word).
  • Time complexity should not exceed O(members.length×messages.length×max⁡(messages[i].length))O(\text{members.length} \times \text{messages.length} \times \max(\text{messages}[i].\text{length})).

Example
Given:

members = ["id123", "id234", "id7", "id321"]
messages = [
    "Hey @id123,@id321 review this PR please! @id321",
    "No mentions here",
    "@id7 @id234,@id123 good work",
    "Keep it up @id123"
]

Expected Output:

["id123=3", "id321=1", "id234=1", "id7=1"]

Title: "Counting Distinct Magical Pairs in Numeria"

Description
In the mystical realm of Numeria, numbers hold secrets waiting to be uncovered. Among the enchanted integers, there are special pairs that nearly mirror each other except for a single trait. You have been provided with an array of these magical numbers, numbers. Your task is to discover how many unique pairs (i, j) exist such that:

  • 0≤i<j<numbers.length0 ≤ i < j < numbers.length

where the numbers are identical in length but differ by exactly one digit.


Example
For numbers = [1, 151, 241, 1, 9, 22, 351], the output should be solution(numbers) = 3.

  • numbers[0] = 1 has a single digit difference with numbers[4] = 9.
  • numbers[1] = 151 differs from numbers[6] = 351 solely in the first digit.
  • numbers[3] = 1 also differs from numbers[4] = 9 in their single shared digit.

Observe that the identical numbers[0] = 1 and numbers[3] = 1 do not count as a pair since they are exactly the same.


Input/Output

  • Execution Time: 0.5 seconds (cpp)
  • Memory Limit: 1 GB

integer:
The number of distinct magical pairs, each characterized by an identical number of digits that differ by one single digit change.

Input

array.integer numbers:
This array comprises positive integers of mystical significance.

Constraints:
1 ≤ numbers.length ≤ 10,000
1 ≤ numbers[i] ≤ 1,000,000,000

Output


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