CPTTRN2 - Character Patterns (Act 2)

Using two characters: . (dot) and * (asterisk) print a frame-like pattern.


You are given t - the number of test cases and for each of the test cases two positive integers: l - the number of lines and c - the number of columns of a frame.


For each of the test cases output the requested pattern (please have a look at the example). Use one line break in between successive patterns.


3 1
4 4
2 5




hide comments
lastcomrade: 2020-09-29 02:43:58

To those who are getting a WA on some hidden test case... My advice to you is to think of a test case when we have only 1 line and only 1 column and thus design your solution keeping that in mind. Also, a little tip try to use string or character arrays for the following lines and just print accordingly on the basis of the number of the line you are iterating on currently. Hope this helps. Cheers!

nithin1997: 2020-01-14 07:43:27

Got the output for the given test case but the hidden test case is failing, can anyone help me.

Last edit: 2020-01-14 10:59:15
nagaraj_hwp: 2019-12-30 08:31:54

Even counted the spaces and did the exact output for that, still Run time error

anhduc2641999: 2019-12-23 09:47:00

Last edit: 2019-12-23 09:49:05
vaibs101: 2019-05-28 17:28:28

My output matches with expected output but also then it is giving an error due to hidden outputs please help!

Last edit: 2019-05-28 17:29:38
kkartik: 2019-03-13 19:57:23

my solution gives the desired output yet it shows it's wrong answer,why?

manoj228: 2018-11-04 15:45:00

i got the answer, Prakash.
:) Our team works makes great.

prakash209: 2018-11-04 15:25:18

I got the same expected ans.. but it shows wrong ans..
whats the problem ??? in this problem , condition for each value it give different result .. so how to we know the except value they given ....

suyashsingh234: 2018-09-04 17:54:12

Can be done using while and for loop easily. Just check individual conditions.

abhishektandon: 2018-08-22 08:29:16


Last edit: 2018-08-22 08:29:49

Added by:kuszi
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64