Skip to content

Commit

Permalink
[SOLVED] HR designer door mat, merge the tools, word order
Browse files Browse the repository at this point in the history
  • Loading branch information
sakib412 committed Feb 1, 2022
1 parent 5e68cf5 commit 873298c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
9 changes: 9 additions & 0 deletions hackerrank/designer-door-mat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
N,M = map(int,input().split())

for i in range(1,N,2):
print((i*".|.").center(M,"-"))

print(("WELCOME").center(M,"-"))

for i in range(N-2, -1, -2):
print((i*".|.").center(M,"-"))
13 changes: 13 additions & 0 deletions hackerrank/merge-the-tools.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def merge_the_tools(string, k):
n = len(string)
t = n//k
for i in range(0,n,k):
substring = ''
for letter in string[i:i+k]:
if letter not in substring:
substring += letter
print(substring)

if __name__ == '__main__':
string, k = input(), int(input())
merge_the_tools(string, k)
13 changes: 13 additions & 0 deletions hackerrank/word-order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
n = int(input())
words = {}
while n:
word = input()
try:
words[word] +=1
except KeyError:
words[word] = 1

n -=1
print(len(words))
print(*words)
print(*words.values())

0 comments on commit 873298c

Please sign in to comment.