Skip to content

Files

Latest commit

JackieHooJackieHoo
JackieHoo
and
JackieHoo
Feb 3, 2020
407fdbc · Feb 3, 2020

History

History
21 lines (20 loc) · 334 Bytes

667.md

File metadata and controls

21 lines (20 loc) · 334 Bytes

Beautiful Arrangement II

解法一

func constructArray(n int, k int) []int {
    := make([]int,0,n)

   i,j := 1,n
   for i <= j {
       if k %2 ==1 {
            = append(,i)
           i++
       }else {
            = append(,j)
           j--
       }
       if k >1 {
          k--
       }
   }
}