# Cannot implicitly convert type 'int' to 'System.Collections.Generic.IList<System.Collections.Generic.IList<int>>' (

I am on this LeetCode puzzle

I am stuck with this error:

``````Line 11: Char 36: error CS0029: Cannot implicitly convert type 'int' to 'System.Collections.Generic.IList<System.Collections.Generic.IList<int>>' (in Solution.cs)
Line 17: Char 16: error CS0029: Cannot implicitly convert type 'int' to 'System.Collections.Generic.IList<System.Collections.Generic.IList<int>>' (in Solution.cs)
``````

The IList is very new to me, so I cannot comprehend what the error is trying to say. Could anyone kindly give me some hint to resolve this error?

My solution code so far is as follows:

``````public class Solution {
public IList<IList<int>> ThreeSum(int[] nums) {
int result = 0;
for(int i = 0; i < nums.Length; i++){
for(int j = 0; j < nums.Length; j++){
for(int k = 0; k < nums.Length; k++){
if(j != k && i != j && i != k){

int sum = nums[i] + nums[j] + nums[k];
if(sum == result){
//Line 11
return nums[i];
}
}
}
}
}
//Line 17
return result;
}
}
``````

IList is just the interface. Basically, to keep it simple just think of it as a collection. So you are looking to an IList of IList of int. So a collection of inner collections that are collections of ints. In array form it would be int. But what are you returning? On line 11 you are returning nums[I], which would be an int as nums is an array of int. The same on line 17 you are returning result which is an int. Clearly an int is an individual thing, but you wanted something that was a collection of collections of ints. The compiler is just saying it doesn’t know how to convert an into into IList<IList>.

What you want to do is at the start create a List<List> (let’s call this result). Then line 11 you want to add the 3 numbers as a list to result (e.g. result.add(new List{1,2,3} but replace 1,2,3 with the values) then on line 17 return result.