[HackerRank][Python3] HackerRank in a String!
2018. 9. 3. 23:40 |
프로그래밍/HackerRank
Problem :
https://www.hackerrank.com/challenges/hackerrank-in-a-string/problem
My Solution :
#!/usr/bin/env python3 def hackerrank_in_string(s): word = 'hackerrank' i = j = 0 while i < len(word) and j < len(s): if word[i] == s[j]: i += 1 j += 1 if i == len(word): return 'YES' return 'NO' q = int(input()) for _ in range(q): s = input() result = hackerrank_in_string(s) print(result)
'프로그래밍 > HackerRank' 카테고리의 다른 글
[HackerRank][Python3] String Construction (0) | 2018.09.05 |
---|---|
[HackerRank][Python3] Beautiful Binary String (0) | 2018.09.05 |
[HackerRank][Python3] Separate the Numbers (0) | 2018.09.04 |
[HackerRank][Python3] Weighted Uniform Strings (0) | 2018.09.04 |
[HackerRank][Python3] Truck Tour (0) | 2018.09.03 |
[HackerRank][Python3] Waiter (0) | 2018.09.03 |
[HackerRank][Python3] Simple Text Editor (0) | 2018.09.02 |
[HackerRank][Python3] Equal Stacks (0) | 2018.09.02 |
최근에 달린 댓글 최근에 달린 댓글