Skip to content

venkatesanios/Spiral-Array-Check

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Spiral-Array-Check

SpiralArray Checking

var fashion = [1,10,14,20,18,12,5] let test = SpiralSorted(arr:fashion) if(test == true) { print("This array is sorted in a spiral") } else { print("This array is NOT sorted in a spiral") }

    func SpiralSorted(arr:[Int])  -> Bool

{ var Spiral = arr.count var first = 0 var last = Spiral - 1

while (first < last) {

     if (arr[first] > arr[last]) {
         return false
    }
    first = first + 1
      if(arr[last] > arr[first])
     {
        return false
    }
    last = last - 1
}

return true

}

About

SpiralArray Checking

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages