当前位置:网站首页>Function run time
Function run time
2022-06-26 10:24:00 【Boundless universe PY】
class Solution:
# Parameters s Enter the original string for
# The return value is a string , It means how long the function with each name has been running
def getRuntime(self, a):
map={}
for i in a:
count = 0
while not i[count] == ’ ':
count = count + 1
fun = i[0 : count]
if i[count+2] == ‘n’:
count = count + 7
v = int(i[count:len(i)])
if fun in map.keys():
map[fun] = v - map[fun]
else:
map[fun] = v
else:
count = count + 6
v = int(i[count:len(i)])
map[fun] = v - map[fun]
res=[]
for i in map:
res.append(i)
res.sort()
for i in range(0,len(res)):
res[i] = res[i] + ‘|’ + str(map[res[i]])
return res
if name == ‘main’:
s = [“F1 Enter 10”,“F2 Enter 18”,“F2 Exit 19”,“F1 Exit 20”]
solution = Solution()
print(" Enter the running time as :", s)
print(" Each output time is :", solution.getRuntime(s))
边栏推荐
- How to start the learning journey of webrtc native cross platform development?
- Pytest configuration file
- Small example of SSM project, detailed tutorial of SSM integration
- Introduction to libmagic
- MySQL Chapter 4 Summary
- 开发者,微服务架构到底是什么?
- Luogu 1146 coin flip
- MySQL第十三次作业-事务管理
- C中字符串基本操作
- 1. sum of two numbers (leetcode topic)
猜你喜欢

Using foreach to loop two-dimensional array

A list of common methods for customizing paint and canvas of view

Call API interface to generate QR code of wechat applet with different colors

首批12家企业入驻!广州首个集中展销老字号产品专柜开张

The fourteenth MySQL operation - e-mall project

創建對象的時候堆內存的分配

Configuration internationale

字符串常量池、class常量池和运行时常量池

【LeetCode】59. Spiral matrix II

Standard implementation of streaming layout: a guide to flexboxlayout
随机推荐
The fourteenth MySQL operation - e-mall project
JSP file syntax
MySQL第六次作业-查询数据-多条件
904. fruit baskets
Using foreach to loop two-dimensional array
MySQL第五章总结
P1296 whispers of cows (quick row + binary search)
Little red book - Notes inspiration - project summary
Appium自动化测试基础 — 移动端测试环境搭建(二)
Omni channel, multi scenario and cross platform, how does app analyze channel traffic with data
The basis of C language grammar -- function definition learning
Some problems to be considered when designing technical implementation scheme
Pytest configuration file
Basic string operations in C
Global and Chinese market for baked potato chips 2022-2028: Research Report on technology, participants, trends, market size and share
1. sum of two numbers (leetcode topic)
Allocation de mémoire tas lors de la création d'objets
JVM垃圾回收什么情况会进入老年代
【Leetcode】76. Minimum covering substring
What should the preview do?