查看程序的输出,我看到它具有如下所示的块:
1th number: 8The product is: 82th number: 8The product is: 643th number: 8The product is: 5124th number: 8The product is: 40965th number: 8The product is: 32768Now the biggest one is: 59049Block number: 684
这说明,对于五个数字的子序列,您实际上只是将其中一个数字乘以五倍。
您需要确保迭代该子序列才能获得产品。
看来问题出在您的行上
greatest.charAt(i)。实际上,您需要添加偏移量
j以获取五位数子序列中的每一位数。



