2023 HUAWEI OD machine test real paper B volume C language implementation [longest common prefix]

Table of contents

topic

train of thought

Code

Require


topic

Write a function to find the longest common suffix in the string array If there is no common suffix, return a fixed string: @Zero.
Supplementary instructions:
1. String length range: [2,1000];

2. The character length range in the string is [1, 126]

Example 1:
Input:

["flower","flow","flight"]
Output:
"fl"
Explanation:
Return public prefix: fl


Example 2:
Input:
["dog","racecar","car"]
Output:
"@Zero"
Explanation:
There is no common prefix, return a fixed result: @Zero

train of thought

1: Simple questions, 

Guess you like

Origin blog.csdn.net/misayaaaaa/article/details/132628257