Replace Elements with Greatest Element on Right Side Solutions in GoNumber 1299Difficulty EasyAcceptance 75.3%Link LeetCodeOther languages —SolutionsGo solution by halfrost/LeetCode-Gopackage leetcode func replaceElements(arr []int) []int { j, temp := -1, 0 for i := len(arr) - 1; i >= 0; i-- { temp = arr[i] arr[i] = j j = max(j, temp) } return arr} func max(a int, b int) int { if a > b { return a } return b}package leetcode func replaceElements(arr []int) []int { j, temp := -1, 0 for i := len(arr) - 1; i >= 0; i-- { temp = arr[i] arr[i] = j j = max(j, temp) } return arr } func max(a int, b int) int { if a > b { return a } return b }