0
Designer Door Mat
Mr. Vincent works in a doormat manufacturing company. One day, he designed a new doormat with the following specifications: Mat size must be X. ( is an odd natural number and is times .) The design should have 'WELCOME' written in the center. The design pattern should only use |, and - characters. I'm not sure how the h and m are used in this problem...If possible can anyone please help?? sample outputs would be in this link. https://www.hackerrank.com/challenges/designer-door-mat/problem
1 ответ
+ 1
N and M are the values needed to make the map. Really you only need N to find out M because M is 3x N. Since N is always an odd number the Mat will always have a middle. Build the pattern where •|• appear in the middle of the -----•|•----- then add 2 •|• to the middle and remove enough --- to get ---•|••|••|•--- until you reach the vertical middle which would be (N - 1) / 2. If you want the middle of M it will be the same thing as N except you want to compensate for •|•. If you want more help I will solve the problem later and send you the solution to read through