I have a coding interview

Could you please help me with the code for the following problem?

Write a program which accepts any movie name as string with all blank spaces are replaced by underscores. Then keeps each letter of the string in a matrix format of M(rows) * N(columns), so that each letter is placed as an element in the matrix including the underscore. The letters should be filled in vertically from top to bottom.

The matrix should be formed such that M is always equal to or greater than N, also the difference between M and N is not more than 1. All the blank elements in the matrix should be filled with underscores. Make sure the last column of the matrix should not have only underscores. Once the matrix is filled, return the first row of the matrix including the underscores if present and without any blank space in-between.

For example if the input string is “gangs_of_wasseypur”

Matrix would look like
g _ a p
a o s u
n f s r
g _ e _
s w y _

And Output going to be “g_ap”.

Can you share the link to the question, please? So that I can verify it’s not from a live test :slight_smile: