当前位置:网站首页>Collection of common algorithm questions in test post interview
Collection of common algorithm questions in test post interview
2022-07-25 08:52:00 【I'm Xiaoming ya】
def pra_01(self):
# Give you an array of integers nums , Where the elements have been arranged in ascending order , Please convert it into a highly balanced tree
# Binary search tree . Highly balanced
# A binary tree is a tree that satisfies 「 The absolute value of the height difference between the left and right subtrees of each node does not exceed 1 」 Two fork tree .
nums = [1,2,3,4,5]
def pra_02(self):
# Given a string , Verify that it is a palindrome string , Consider only alphabetic and numeric characters , The case of letters can be ignored
str = 'Aabffbaa'
if str.lower() == str[::-1].lower():print('yes')
def pra_03(self):
# Given an array of non-empty integers , Except that an element only appears once , Each of the other elements occurs twice . Find the element that only appears once .
# explain : Your algorithm should have linear time complexity . Can you do this without using extra space ?
nums = [1,2,2,3,3]
result = 0
for num in nums:result = result ^ num
print(result)
def pra_04(self):
# Given a string , Find the character that appears most often
s = 'abca'
l = list(s)
max = 0
result = ''
for i in range(0,len(l)-1):
sum = 0
print(l[i],l[i+1])
for j in range(i+1,len(l)-2):
if l[i] == l[j]:sum=sum+1
if sum>max: max = sum;result = l[i]
print(max,result)
边栏推荐
- JDBC的api全解
- Foundation 32: page element positioning method XPath --- axis positioning method
- Wechat sports ground reservation applet graduation project of applet completion works (1) development outline
- NVIDIA可编程推理加速器TensorRT学习笔记(二)——实操
- js弹出式城市筛选组件匹配手机移动端
- QA robot sequencing model
- Redis/Mysql知识概述
- YOLOV5环境配置
- When testing VPN, the IP found by the command line is inconsistent with that of Baidu search
- @Use of data annotation (instead of get and set methods in entity classes)
猜你喜欢

Wechat reservation of completed works of applet graduation project (4) opening report

IDEA下依赖冲突解决方法

这是我见过写得最烂的Controller层代码...
![[Development Tutorial 9] crazy shell · open source Bluetooth smart health watch - storage](/img/25/212712d919540763a6c339e1b5a50b.png)
[Development Tutorial 9] crazy shell · open source Bluetooth smart health watch - storage

Wechat reservation applet graduation design of applet completion works (2) applet function

table表格展开内部行切换效果

FreeMaker模板引擎

When testing VPN, the IP found by the command line is inconsistent with that of Baidu search

@The difference and use of value and configurationproperties

Graduation project of wechat small program ordering system of small program completion works (6) opening defense ppt
随机推荐
[graduation project] cinema booking management system based on micro Service Framework
Django4.0 + web + MySQL 5.7 realize simple login operation
Redis/Mysql知识概述
Wechat sports ground reservation applet graduation design of applet completion works (3) background function
IDEA下依赖冲突解决方法
js小游戏源码魔塔闯关下载
canvas很多圆圈组成的文本js特效
Cool canvas animation shock wave JS special effect
Graduation project of wechat small program ordering system of small program completion works (7) Interim inspection report
Solving a random number problem
@Principle of Autowired annotation
附加:下半部分sql语句 区/县(数据表)
This is the worst controller layer code I've ever seen
Efcore's solution of multi tenant zero script, table and database read-write separation under SaaS system
Canvas dynamic picture avatar shaking JS special effect
【无标题】
Solve the syntaxerror: unexpected end of JSON input
Initial knowledge of WebService (generate jar packages and call methods in remote services)
【万字长文】使用 LSM-Tree 思想基于.Net 6.0 C# 实现 KV 数据库(案例版)
JD cloud and Forrester consulting released a hybrid cloud report that cloud Nativity has become a new engine driving industrial development