Traverse Matrix in Diagonal strips

前端 未结 16 1859
暖寄归人
暖寄归人 2020-11-28 02:55

I thought this problem had a trivial solution, couple of for loops and some fancy counters, but apparently it is rather more complicated.

So my question is, how woul

16条回答
  •  醉话见心
    2020-11-28 03:50

    I would probably do something like this (apologies in advance for any index errors, haven't debugged this):

    // Operation to be performed on each slice:
    void doSomething(const int lengthOfSlice,
                     elementType *slice,
                     const int stride) {
        for (int i=0; i

提交回复
热议问题