-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Empty file.
Empty file.
Empty file.
Empty file.