Writing a string in a spiral

后端 未结 11 1035
别那么骄傲
别那么骄傲 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:35

    As I understand:

    You have

    ABCHIDGFE
    

    You convert it to square (if possible)

    A B C
    H I D
    G F E
    

    And then make string going clockwise

    A B C D E F G H I
    

    And return this string

    I'm not sure what to do if it's impossible to make square of it.

提交回复
热议问题