Writing a string in a spiral

后端 未结 11 1079
别那么骄傲
别那么骄傲 2020-12-30 11:29

I had recently participated in coding competion sponsored by an company and there was this one question which I did not understood, as to what was it asking.

Here i

11条回答
  •  南笙
    南笙 (楼主)
    2020-12-30 11:32

    Calculating the minimum square is quite easy. you can just check the no of characters in input string and the minimum square size n*n.

    1*1= 1 
    2*2 = 4
    3*3 = 9
    

    so you can easily find the n by putting in formula

    n*n >= length(input string). 
    

提交回复
热议问题