当前位置:网站首页>[leetcode brush questions]
[leetcode brush questions]
2022-07-25 11:41:00 【88 year old programming with injury】
leetcode Brush problem
Letter combination of telephone number ( secondary )

def letterCombinations(self, digits):
if len(digits)==0:
return []
dict={
0:"0",1:"1",2:"abc",3:"def",4:"ghi",5:"jkl",6:"mno",7:"pqrs",8:"tuv",9:"wxyz"}
result=[""]
for i in digits:
list=[]
for j in dict[int(i)]:
for k in result:
list.append(k+j)
result=list
return result
String multiplication ( secondary )


def multiply(self, num1, num2):
if num1=='0' or num2=='0':
return '0'
if len(num1)<len(num2):
num1,num2=num2,num1
num1=num1[::-1] # Perform array transposition
num2=num2[::-1]
list=[]
for i in range(len(num2)):
for j in range(len(num1)):
new_num=int(num2[i]+'0'*i)
new_num_1=int(num1[j]+'0'*j)
list.append(new_num*new_num_1)
ans=sum(list)
return str(ans)
边栏推荐
- Database integrity -- six constraints learning
- 第一个C语言程序(从Hello World开始)
- Filter过滤器解决request请求参数乱码的原理解析
- Greedy problem 01_ Activity arrangement problem
- Nowcodertop7-11 - continuous updating
- SQL injection less17 (error injection + subquery)
- 用 Redis 做一个可靠的延迟队列
- 贪心问题01_活动安排代码分析
- 教你如何通过MCU将S2E配置为UDP的工作模式
- 菜单栏+状态栏+工具栏==PYQT5
猜你喜欢

Want to record your supernatural moments when playing games? Let's take a look at how to use unity screenshots

同事看了我的代码惊呼:居然是这么在Unity中用单例的

活动报名 | 玩转 Kubernetes 容器服务提高班正式开营!

常见WEB攻击与防御

Small and micro enterprise smart business card management applet

SQL注入 Less18(头部注入+报错注入)

Emmet syntax quick query syntax basic syntax part

Linked list related (design linked list and ring linked list)

Reinforcement learning (IV)
Details of the list of state products that Apple announced to be eligible for the sales tax holiday in the United States
随机推荐
WIZnet嵌入式以太网技术培训公开课(免费!!!)
SQL language (I)
让运动自然发生,FITURE打造全新生活方式
W5500在处于TCP_Server模式下,在交换机/路由器网络中无法ping通也无法通讯。
[tree] 100. Same tree
新能源销冠宏光MINIEV,有着怎样的产品力?
Some errors of tensorflow calling multiple GPUs
Mlx90640 infrared thermal imager temperature measurement module development notes (V)
The most complete detailed tutorial on importing ad into lichuanyuan device packaging Library in history (always white and always cool)
基于MATLAB的常见线性调制方法
SQL language (4)
Dynamic planning question 05_ Missile interception
MySQL | GROUP_ The concat function concatenates the values of a column with commas
教你如何通过MCU配置S2E为TCP Server的工作模式
Stm32cubemx learning record -- installation, configuration and use
Game backpack system, "inventory Pro plug-in", research and learning ----- mom doesn't have to worry that I won't make a backpack anymore (unity3d)
There is a newline problem when passing shell script parameters \r
Why should the hashcode () method be rewritten when rewriting the equals () method
Talking about Devops monitoring, how does the team choose monitoring tools?
ArcMap cannot start the solution