Last active
February 3, 2022 03:43
-
-
Save yuhangwang/eb9f2b0f567f1f14b311b303306172d0 to your computer and use it in GitHub Desktop.
Revisions
-
yuhangwang revised this gist
Feb 3, 2022 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ # see: https://www.deepmind.com/blog/article/Competitive-programming-with-AlphaCode # Why AlphaCode generated an unused variable `c` to store a string that has no use at all? t = int(input()) for i in range(t): s = input() -
yuhangwang created this gist
Feb 3, 2022 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ # see: https://www.deepmind.com/blog/article/Competitive-programming-with-AlphaCode t = int(input()) for i in range(t): s = input() t = input() a = [] b = [] for j in s: a.append(j) for j in t: b.append(j) a.reverse() b.reverse() c = [] while len(b) != 0 and len(a) != 0: if a[0] == b[0]: c.append(b.pop(0)) a.pop(0) elif a[0] != b[0] and len(a) != 1: a.pop(0) a.pop(0) elif a[0] != b[0] and len(a) == 1: a.pop(0) if len(b) == 0: print("YES") else: print("NO")