/** * @param r: a Integer represent radius * @return: the circle's circumference nums[0] and area nums[1] */func Calculate(r int) []float64 { // write your code here slice := make([]float64,2) Pi := 3.14 slice[0] = 2 * Pi * float64(r) slice[1] = Pi * float64(r * r) return slice}
/** * @param n: a number represent year * @return: whether year n is a leap year. */func IsLeapYear(n int) bool { // write your code here if n % 4 == 0 && n % 100 != 0 || n % 400 == 0 { return true } return false}
/** * @param nums: a integer array * @return: nothing */func ReverseArray(nums []int) { // write your code here l, r := 0, len(nums)-1 for i := 0; i < len(nums)/2; i++ { nums[l], nums[r] = nums[r], nums[l] l++ r-- }}