Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func countDraw(_ arr:[Int]) -> Int{
- guard arr.count > 0 else {return 0}
- var temp = arr
- while temp[0] != 0 {
- //need to check count!!!, for all 1 case
- // todo
- let f = temp.removeFirst()
- temp.append(f)
- }
- var res = 0
- var i = 0
- while i < temp.count{
- if temp[i] == 0 {
- i += 1
- continue
- }
- res += 1
- i += 1
- while i < temp.count && temp[i] != 0 {
- i += 1
- }
- }
- return res
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement