← 返回 coinbase 的题目列表Find and Sort User Files by Prefix and Suffix
类型:online_judge
Given a list of user files where each file has a filename, implement a function to find user files by a given prefix and suffix, and return the filenames in a specified sort order.
Requirements
Inputs:
files: List[str] - list of filenames
prefix: str - prefix string
suffix: str - suffix string
Output:
List[str] - list of filtered and sorted filenames based on prefix and suffix
Example
Example 1:
Input: files = ["test1.txt", "example.txt", "sample1.log"], prefix = "ex", suffix = ".txt"
Output: ["example.txt"]
Constraints
The length of the filename list should not exceed 1000.
Filenames should not exceed 255 characters.
Example
Input
"test1.txt\nexample.txt\nsample1.log\nex\n.txt\n"