C# sliding window solution
time: O(N)\n- space: O(N)\n\n\npublic class Solution {\n    public int MaximumUniqueSubarray(int[] nums) {\n        \n        if(nums == null || nums.Length == 
- time: O(N)\n- space: O(N)\n\n```\npublic class Solution {\n    public int MaximumUniqueSubarray(int[] nums) {\n        \n        if(nums == null || nums.Length == 0)\n            return 0;\n        \n        Dictionary<int,int> dic = new Dictionary<int,int>();\n        int left = 0, right = 0, sum = 0, max = 0, counter = 0;\n        while(right < nums.Length)\n        {\n            int rightNum = nums[right];\n            sum += rightNum;\n            if(dic.ContainsKey(rightNum))\n            {\n                dic[nums[right]]++;\n                if(dic[rightNum] > 1)\n                    counter++;\n            }\n            else\n                dic.Add(rightNum,1);\n            right++;\n            \n            while(counter > 0)\n            {\n                int leftNum = nums[left];\n                dic[leftNum]--;\n                if(dic[leftNum] == 1)\n                    counter--;\n                sum -= leftNum;\n                left++;\n            }\n            \n            max = Math.Max(max,sum);\n        }\n        \n        return max;\n    }\n}\n```
[]