当前位置:网站首页>[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)
边栏推荐
- Greedy problem 01_ Activity arrangement code analysis
- 同事看了我的代码惊呼:居然是这么在Unity中用单例的
- What kind of product power does Hongguang miniev, the top seller of new energy, have?
- Linked list related (design linked list and ring linked list)
- shell-第四天作业
- Detailed explanation of lvs-nat and lvs-dr modes of LVS load balancing
- SQL language (II)
- Dataframe print ellipsis problem
- 全网显示 IP 归属地,是怎么实现的?
- Introduction to shortcut keys in debug chapter
猜你喜欢

W5500上传温湿度到oneNET平台

2022 年中回顾|一文看懂预训练模型最新进展

SQL language (II)

基于Caffe ResNet-50网络实现图片分类(仅推理)的实验复现

第一个C语言程序(从Hello World开始)

Talking about Devops monitoring, how does the team choose monitoring tools?

Emmet syntax quick query syntax basic syntax part

Small and micro enterprise smart business card management applet

小区蔬菜配送的小程序

新能源销冠宏光MINIEV,有着怎样的产品力?
随机推荐
常见WEB攻击与防御
矩阵的特征值和特征向量
活动报名 | 玩转 Kubernetes 容器服务提高班正式开营!
MySQL | GROUP_ The concat function concatenates the values of a column with commas
黑客入门教程(非常详细)从零基础入门到精通,看完这一篇就够了。
SQL注入 Less18(头部注入+报错注入)
Detailed explanation of lvs-nat and lvs-dr modes of LVS load balancing
Shell fourth day homework
Talking about Devops monitoring, how does the team choose monitoring tools?
谣言检测文献阅读十一—Preventing rumor spread with deep learning
【mysql学习09】
动态规划问题03_最大子段和
There is a newline problem when passing shell script parameters \r
Definition of information entropy
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)
leetcode 剑指 Offer 28. 对称的二叉树
【mysql学习08】
Nowcodertop1-6 - continuous updating
DNS分离解析的实现方法详解
JS convert pseudo array to array