Skip to content

Commit

Permalink
11.py
Browse files Browse the repository at this point in the history
  • Loading branch information
oje2024 committed Aug 31, 2024
1 parent 9e89ced commit f5c3e64
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 0 deletions.
14 changes: 14 additions & 0 deletions JEOH/11to20/11.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
def solution(s):
answer=0
stack=[]
for i in s:
if stack and stack[-1]==i:
stack.pop()
else:
stack.append(i)
if stack:
answer=0
else:
answer=1

return answer
Empty file added JEOH/11to20/12.py
Empty file.
Empty file added JEOH/1to10/10.py
Empty file.
14 changes: 14 additions & 0 deletions JEOH/1to10/8.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
def solution(a):
stack=[]
for i in a:
if i=="(":
stack.append(i)
elif i==")":
if not stack:
return False
else:
stack.pop()
if stack:
return False
else:
return True
10 changes: 10 additions & 0 deletions JEOH/1to10/9.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def solution(num):
stack=[]
while num>1:
a=num%2
num=num//2
stack.append(str(a))
stack.append(str(num))
stack.reverse()
bin=''.join(stack)
return bin
Empty file added JEOH/81to90/81.py
Empty file.
Empty file added JEOH/91to100/91.py
Empty file.
Empty file added JEOH/91to100/92.py
Empty file.
Empty file added JEOH/91to100/93.py
Empty file.
Empty file added JEOH/91to100/94.py
Empty file.

0 comments on commit f5c3e64

Please sign in to comment.