2026年人工智能领域面试笔试题集.docxVIP

  • 1
  • 0
  • 约3.85千字
  • 约 13页
  • 2026-09-05 发布于福建
  • 举报

第PAGE页共NUMPAGES页

2026年人工智能领域面试笔试题集

一、编程语言与基础算法(10题,共50分)

1.Python编程基础(2题,每题10分)

题目1:

编写一个Python函数,接收一个字符串列表,返回其中所有包含重复字符的字符串。

答案:

python

deffind_duplicates(strings):

result=[]

forsinstrings:

iflen(s)!=len(set(s)):

result.append(s)

returnresult

解析:

通过集合去重判断字符串中字符是否重复,若长度变化则存在重复字符。

题目2:

实现一个LRU(最近最少使用)缓存,支持get和put操作,容量为3。

答案:

python

classLRUCache:

def__init__(self,capacity:int):

self.cache={}

self.capacity=capacity

self.order=[]

defget(self,key:str)-int:

ifkeyinself.cache:

self.order.remove(key)

self.order.append(key)

returnself.cache[key]

return-1

defput(s

文档评论(0)

1亿VIP精品文档

相关文档