Mon Sep 22 2025 09:59:50 GMT+0000 (Coordinated Universal Time)
Saved by @Inescn
public int removeDuplicates(int[] nums){ if (nums.length = 0) return 0; int i = 0; for (int j = 1; j < nums.length; j++) { if (nums[j] != nums[i]) { i++; nums[i] = nums[j]; } } return i + 1; }
Copy this HTML code:
Preview:
open_in_newInstructions on embedding in Medium
Comments