Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 50c3199

Browse files
add: 1221
1 parent 477388b commit 50c3199

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

‎string/main.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,49 @@
9898
# a = Solution()
9999
# print(a.maximumNumberOfStringPairs(words))
100100

101+
################*******@Ziyodev*********######################
102+
103+
#--------------- 1221. Split a String in Balanced Strings -----------------#
104+
# start | 01:52
105+
# end |
106+
107+
108+
# class Solution(object):
109+
# def balancedStringSplit(self, s):
110+
# """
111+
# :type s: str
112+
# :rtype: int
113+
# """
114+
# check = {'R': 0, 'L': 0}
115+
# count=0
116+
# for word in s:
117+
# check[word] += 1
118+
# if check['R'] == check['L']:
119+
# count += 1
120+
# check['R'] = 0
121+
# check['L'] = 0
122+
# return count
123+
124+
# s = "RLRRLLRLRL"
125+
# s = "RLRRRLLRLL"
126+
# # s = "LLLLRRRR"
127+
# a = Solution()
128+
# print(a.balancedStringSplit(s))
129+
130+
# zor yechimi
131+
132+
# c = 0
133+
# countl = 0
134+
# countr = 0
135+
# for i in range(len(s)):
136+
# if s[i] == 'L':
137+
# countl += 1
138+
139+
# else:
140+
# countr += 1
141+
# if countr == countl:
142+
# c +=1
143+
# return c
144+
145+
101146
################*******@Ziyodev*********######################

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /