public static int[] twoSum(int[] arr, int target)
{
for ( int i = 0; i < arr.Length; i++ )
{
for ( int j = i + 1; j < arr.Length; j++ )
{
if ( ( arr[i] + arr[j] ) == target )
{
return new int[] { i, j };
}
}
}
}
I have coded a function but it is giving me an error which say "not all code paths return a value" 2 times, i am really not understanding where the problem is, Please Help me by providing a Fix for this problem. I am having really hard time solving the error.