Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis0
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 Resposta
+ 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