注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
本帖最后由 匿名 于 2025-3-26 15:16 编辑
这个没排版好,可以看最新的
12月做的笔试了,最近有人问就找了一下。因为拍的模糊就让gpt识别了一下文字再发上来
第二题略难先放上来,最下面是第一题---
---
### 2. Company Usernames
When the Company hires new employees, it needs to assign usernames to them. Your task is to implement a system to assign unique usernames to new hires at the Company.
Given an array of real-world names, `names`, return an array of usernames, `usernames`, each of which must be unique.
---
### Username constraints:
1. Maximum length of the username is always 8 characters, and should be as close to 8 characters as possible.
2. May only contain characters in the sets `[a-z]` and `[0-9]`, beware real-world names containing hyphens and apostrophes.
3. A username must be unique within the Company.
---
The **default username** for a person is composed of a maximum of the first **7 characters** of their **family name**, followed by as many letters osten it is listensilent it is silentsilent it is listen
---
Function Description
Complete thefunction in the editor below.has the following parameters:- : an array of strings
- : an array of strings
Returns:- : an array ofintegers that denote the number of sentences that can be formed from each sentence
---
Constraints- \( 0 < n \leq 10^5 \)
- \( 1 \leq \text{length of each word} \leq 20 \)
- \( 1 \leq m \leq 1000 \)
- \( 3 \leq \text{words in a sentence} \leq 20 \)
--- |