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