Arrays 101 Code from Java to Go(A Better Repeated Deletion Algorithm - Intro)
The nested loop Code Java class Solution { public int removeDuplicates(int[] nums) { // The initial length is simply the capacity. int length = nums.length; // Assume the last element is always unique. // Then for each element, delete it iff it is // the same as the one after it. Use our deletion // algorithm for deleting from any index. for (int i = length - 2; i >= 0; i--) { if (nums[i] == num..
Go/Leet Code
2022. 3. 6. 20:14