当前位置:网站首页>Force buckle 2315 Statistical asterisk
Force buckle 2315 Statistical asterisk
2022-07-07 20:06:00 【Tomorrowave】
List of articles
2315. Statistical asterisk
Give you a string s , Every time Two Continuous vertical line ‘|’ by a pair . In other words , The first and the second ‘|’ It's a couple , The third and the fourth ‘|’ It's a couple , And so on .
Please return be not in Between vertical line pairs ,s in ‘*’ Number of .
Be careful , Each vertical line ‘|’ Metropolis just Belong to a pair .
Example 1:
Input :s = “l|eet|co|*de|"
Output :2
explain : Characters not between vertical line pairs are bold and italicized , Get a string :"l|eet|co|*de|” .
The first and second vertical lines ‘|’ Characters between are not included in the answer .
meanwhile , The third and fourth vertical lines ‘|’ Characters between are not included in the answer .
There is a total of... Between vertical line pairs 2 asterisk , So we go back to 2 .
Ideas :
matching
Code section
class Solution(object):
def countAsterisks(self, s):
""" :type s: str :rtype: int """
cnt=0
c=0
for i in s:
if i=='|':
cnt+=1
elif cnt%2==0 and i=='*':
c+=1
return c
边栏推荐
- R语言ggplot2可视化:使用ggpubr包的ggviolin函数可视化小提琴图、设置palette参数自定义不同水平小提琴图的填充色、add参数在小提琴图添加箱图
- PMP practice once a day | don't get lost in the exam -7.7
- 关于cv2.dnn.readNetFromONNX(path)就报ERROR during processing node with 3 inputs and 1 outputs的解决过程【独家发布】
- 项目经理『面试八问』,看了等于会了
- Tp6 realize Commission ranking
- Chapter 9 Yunji datacanvas was rated as 36 krypton "the hard core technology enterprise most concerned by investors"
- mysql 的一些重要知识
- 力扣 1961. 检查字符串是否为数组前缀
- Cloud 组件发展升级
- LC: string conversion integer (ATOI) + appearance sequence + longest common prefix
猜你喜欢

YoloV6:YoloV6+Win10---训练自己得数据集

PMP对工作有益吗?怎么选择靠谱平台让备考更省心省力!!!

8 CAS

Simulate the implementation of string class
让这个 CRMEB 单商户微信商城系统火起来,太好用了!

vulnhub之school 1

Automatic classification of defective photovoltaic module cells in electroluminescence images-論文閱讀筆記

数据孤岛是企业数字化转型遇到的第一道险关

CSDN语法说明

力扣 2319. 判断矩阵是否是一个 X 矩阵
随机推荐
力扣 1961. 检查字符串是否为数组前缀
torch.nn.functional.pad(input, pad, mode=‘constant‘, value=None)记录
关于自身的一些安排
841. 字符串哈希
九章云极DataCanvas公司摘获「第五届数字金融创新大赛」最高荣誉!
JVM 类加载机制
【STL】vector
Time tools
力扣 2319. 判断矩阵是否是一个 X 矩阵
一文读懂数仓中的pg_stat
831. KMP string
Cloud 组件发展升级
ASP. Net learning & ASP's one word
时间工具类
R language dplyr package mutate_ At function and min_ The rank function calculates the sorting sequence number value and ranking value of the specified data column in the dataframe, and assigns the ra
ASP.NET体育馆综合会员管理系统源码,免费分享
Ucloud is a basic cloud computing service provider
LeetCode力扣(剑指offer 36-39)36. 二叉搜索树与双向链表37. 序列化二叉树38. 字符串的排列39. 数组中出现次数超过一半的数字
LC: string conversion integer (ATOI) + appearance sequence + longest common prefix
Cuda版本不一致,编译apex报错