Remove Element Solutions in GoNumber 27Difficulty EasyAcceptance 48.3%Link LeetCodeOther languages C++SolutionsGo solution by halfrost/LeetCode-Gopackage leetcode func removeElement(nums []int, val int) int { if len(nums) == 0 { return 0 } j := 0 for i := 0; i < len(nums); i++ { if nums[i] != val { if i != j { nums[i], nums[j] = nums[j], nums[i] j++ } else { j++ } } } return j}package leetcode func removeElement(nums []int, val int) int { if len(nums) == 0 { return 0 } j := 0 for i := 0; i < len(nums); i++ { if nums[i] != val { if i != j { nums[i], nums[j] = nums[j], nums[i] j++ } else { j++ } } } return j }