阅读背景:

什么应该是从阵列A获取阵列B的正确算法

来源:互联网 

Array A= [1,0,1,1,1,1,0,1,1]]; And the result will be B B=[1,0,4,3,2,1,0,2,1]; the elements of A is given and the result will be B. Elements in A can only be 0 and 1. we need to count backward from the last element in A, if there are consecutive 1's then the element in A and B will be 1 but for the 2nd consecutive 1 in A it will be 2 in be and for the 3rd one in A the element will be 3 in B but for 0 it will be 0. I have tried the following way but I am not getting the output.Array A= [1,0,1,1,1,1,0,1,1]]; And the result w




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: