Hello, there seems to be a problem with the excercise , test in VSTudio 2019, and it works perfectly. As well when tried with different variations of the code below. The result always seems to fix itself into a wrong value [1,1] instead of the actual values within the nums1/nums array.
Double checked for reference/value pass on other iterations so i know the problem persists because of a problem with the platform not liking my implementation.
'''
public class Solution {
public int RemoveDuplicates(int[] nums) {
if (nums.Count() == 0)
return 0;
if(nums.Count() == 1)
return 1;
int [] nums1 = nums.ToList().Distinct().ToArray();
Console.WriteLine(nums1[nums1.Length-1]);
nums1[nums1.Length-1] = nums[nums.Length - 1];
Console.WriteLine(nums1[nums1.Length-1]);
nums = new int[nums1.Length] ;
nums = nums1;
return nums.Length;
}}
'''