[HackerRank][Python3] Append and Delete
2018. 6. 10. 23:32 |
프로그래밍/HackerRank
Problem :
https://www.hackerrank.com/challenges/append-and-delete/problem
My Solution :
#!/usr/bin/env python3
def appendAndDelete(s, t, k):
i = 0
while i < min(len(s), len(t)):
if s[i] != t[i]:
break
i += 1
move = len(s) + len(t) - 2*i
remain = k - move
if remain < 0 or (remain%2 == 1 and remain < 2*i):
return False
return True
s = input()
t = input()
k = int(input())
print('Yes') if appendAndDelete(s, t, k) else print('No')
'프로그래밍 > HackerRank' 카테고리의 다른 글
| [HackerRank][Python3] Minimum Swaps 2 (0) | 2018.07.06 |
|---|---|
| [HackerRank][Python3] Is This a Binary Search Tree? (2) | 2018.06.25 |
| [HackerRank][Python3] Candies (0) | 2018.06.14 |
| [HackerRank][Python3] Two Characters (0) | 2018.06.11 |
| [HackerRank][Python3] Recursive Digit Sum (0) | 2018.06.07 |
| [HackerRank][Python3] Sam and substrings (0) | 2018.06.06 |
| [HackerRank][Python3] Marc's Cakewalk (0) | 2018.06.06 |
| [HackerRank][Python3] Minimum Loss (0) | 2018.06.05 |
최근에 달린 댓글 최근에 달린 댓글