LinkedList CMULT返回链表的方法

问题描述 投票:-2回答:1

编写一个方法public static LinkedList CMult(LinkedList L1),它接受单个LinkedList L1并创建一个相同长度的新LinkedList L2,这样L1的节点i包含L1节点中数据的乘法,包括节点i和列表L1。为下面的场景编写方法main。例如:使用以下L1调用方法CMult将返回以下L2。 see image to understand the concept我需要帮助

java
1个回答
0
投票
for(int i=0;i<L1.length;i++){
   int temp=1;
   for(int j=0;j<=i;j++){
      temp*=L2[j] ;
      } 
    L2.add(temp)
}

你去那里我为不整洁的答案道歉,我正在用手机打字。

© www.soinside.com 2019 - 2024. All rights reserved.