Hello I have been trying to solve this problem using basic star pattern logic. My approach is — first create the upper half of the pyramid and then add the next portion of the pyramid.For that I first initialize all the elements of the 2d array in null value**('\0')**.And my compiler shows the exact same result as in the description.But somehow codeforces compiler showing weird symbols for ('\0') .I have also tried char(0) which also give me weird symbols.My submissions here and here.How can I get ac from this submission?
When you initialize a char array always set all values to a known character which is not used in the problem (Like '#' or '@' etc.), and if this value is still the same is the initialized value then your implementation didn't change it so you do as required in the problem statement (here, set it to ' ') This will guarantee not to do such behavior.
Anyway, this is happening because you said I want this value to be char(0), the compiler on your PC didn't recognized it so it printed nothing.. that doesn't mean it is really a space and you don't have to get yourself into such troubles so i recommend you do as I said above.
Actually,that was one of my wrong submissions.Yes here there is no weird characters but using ' ' I just created empty space which violates the problem statement.Here is the submission
You need to remove the trailing spaces. You can add a '\0' right after where a char array ends (after the last 0 in each line)
Yes Here you did as I said but still got wrong answer because you printed extra spaces after the last character in each line.
" 0 "
is not" 0"