Designer Door Mat Hacker Rank Solution – Queslers

Problem: Designer Door Mat Hacker Rank Solution

Mr. Vincent works in a door mat manufacturing company. One day, he designed a new door mat with the following specifications:

     1. Mat size must be MXN. (N is an odd natural number, and M is 3 times N.)
     2. The design should have 'WELCOME' written in the center. 
     3. The design pattern should only use |, . and - characters.


Sample Designs:

    Size: 7 x 21 
    ---------.|.---------
    ------.|..|..|.------
    ---.|..|..|..|..|.---
    -------WELCOME-------
    ---.|..|..|..|..|.---
    ------.|..|..|.------
    ---------.|.---------
    
    Size: 11 x 33
    ---------------.|.---------------
    ------------.|..|..|.------------
    ---------.|..|..|..|..|.---------
    ------.|..|..|..|..|..|..|.------
    ---.|..|..|..|..|..|..|..|..|.---
    -------------WELCOME-------------
    ---.|..|..|..|..|..|..|..|..|.---
    ------.|..|..|..|..|..|..|.------
    ---------.|..|..|..|..|.---------
    ------------.|..|..|.------------
    ---------------.|.---------------


Input Format:

A single line containing the space separated values of M and N.

Constraints:
3<N<101
15<M<303

Output Format:

Output the design pattern.

Designer Door Mat Hacker Rank Solution in Pyhton 2

N, M = map(int,raw_input().split()) # More than 6 lines of code will result in 0 score. Blank lines are not counted.
for i in xrange(1,N,2): 
    print 3*(N-i)/2*"-"+".|."*i+"-"*(3*(N-i)/2)
print "-"*((3*N-7)/2)+"WELCOME"+"-"*((3*N-7)/2)
for i in xrange(N-2,-1,-2): 
    print (3*(N-i)/2)*"-"+".|."*i+"-"*(3*(N-i)/2)

Designer Door Mat Hacker Rank Solution in Pyhton 3

n, m = map(int,input().split())
pattern = [('.|.'*(2*i + 1)).center(m, '-') for i in range(n//2)]
print('\n'.join(pattern + ['WELCOME'.center(m, '-')] + pattern[::-1]))

Designer Door Mat Hacker Rank Solution in pypy

N, M = map(int,raw_input().split()) 
for i in xrange(1,N,2): 
    print "-"*(M/2-(3*i-1)/2)+ ".|."*((i-1)/2)+".|." + ".|."*((i-1)/2) + "-"*(M/2-(3*i-1)/2)
print "WELCOME".center(M,"-")
for i in xrange(N-2,-1,-2): 
    print "-"*(M/2-(3*i-1)/2) + ".|."*((i-1)/2)+".|." + ".|."*((i-1)/2) + "-"*(M/2-(3*i-1)/2)

Designer Door Mat Hacker Rank Solution in pypy3

n, m = map(int,input().split())
pattern = [('.|.'*(2*i + 1)).center(m, '-') for i in range(n//2)]
print('\n'.join(pattern + ['WELCOME'.center(m, '-')] + pattern[::-1]))
Designer Door Mat Hacker Rank Solution Review:

In our experience, we suggest you solve this Designer Door Mat Hacker Rank Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

Designer Door Mat Problem is available on Hacker Rank for Free, if you are stuck anywhere between compilation, just visit Queslers to get all Hacker Rank Solution

Conclusion:

I hope this Designer Door Mat Hacker Rank Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Hacker Rank, Leetcode, Codechef, Codeforce Solution.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More Hacker Rank Problem & Solutions >>

Merge the Tools! Hacker Rank Solution

Text Alignment Hacker Rank Solution

The Minion Game Hacker Rank Solution

itertools.product() Hacker Rank Solution

String Validators Hacker Rank Solution

Leave a Reply

Your email address will not be published.