Unable to convert List> to return type IList>

前端 未结 3 1288
名媛妹妹
名媛妹妹 2021-01-18 01:31

For level order traversal why does this exception occur? Following exception occurs:

Cannot implicitly convert type \'System.Collections.Generic

3条回答
  •  无人及你
    2021-01-18 02:13

    There should be explicit conversion and as shown below:-

    List> result = new List>();

    or

    var result = new List>();

提交回复
热议问题