当前位置:网站首页>[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)
边栏推荐
- Smart cloud IOT platform STM32 esp8266-01s simple wireless light control
- Nowcodertop12-16 - continuous updating
- 大话DevOps监控,团队如何选择监控工具?
- How to judge the performance of static code quality analysis tools? These five factors must be considered
- Dynamic planning problem 03_ Maximum sub segment sum
- Database integrity -- six constraints learning
- SQL injection less23 (filter comment)
- What kind of product power does Hongguang miniev, the top seller of new energy, have?
- 【mysql学习09】
- shell-第六章练习
猜你喜欢

leetcode 剑指 Offer 27. 二叉树的镜像

玩游戏想记录一下自己超神的瞬间?那么就来看一下如何使用Unity截图吧

大话DevOps监控,团队如何选择监控工具?

The most efficient note taking method in the world (change your old version of note taking method)

leetcode 剑指 Offer 28. 对称的二叉树

Leetcode sword finger offer 28. symmetric binary tree

ArcMap cannot start the solution

W5500上传温湿度到oneNET平台

小区蔬菜配送的小程序

2022 年中回顾|一文看懂预训练模型最新进展
随机推荐
常见的几种PCB表面处理技术!
The most efficient note taking method in the world (change your old version of note taking method)
Shell - Chapter 6 exercise
一篇看懂:IDEA 使用scala 编写wordcount程序 并生成jar包 实测
绘图==PYQT5
shell-第五章作业
cookie and session
将字符串转换为数字
同事看了我的代码惊呼:居然是这么在Unity中用单例的
MLX90640 红外热成像仪测温模块开发笔记(五)
Redis 入门
shell-第八章练习
Shell fourth day homework
数据库设计-简化字典表[通俗易懂]
硬件外设=maixpy3
Mlx90640 infrared thermal imager temperature measurement module development notes (V)
Dataframe print ellipsis problem
Multiply Floyd "suggestions collection"
W5500多节点连接
Let sports happen naturally, and fire creates a new lifestyle