Skip to content

Instantly share code, notes, and snippets.

@FabiolaRamirez
Last active May 13, 2020 23:37
Show Gist options
  • Save FabiolaRamirez/f0fd5b66dbbea66c7dac419491548461 to your computer and use it in GitHub Desktop.
Save FabiolaRamirez/f0fd5b66dbbea66c7dac419491548461 to your computer and use it in GitHub Desktop.
https://jsonmock.hackerrank.com/api/movies/search/?Title=substring
{
"page": 1,
"per_page": 10,
"total": 0,
"total_pages": 0,
"data": []
}
@alvareztech
Copy link

    var generalCounter = 0
    
    
    for z in 1..<arr.count {
        for w in 0..<arr.count {
            var oddsCounter = 0
            var i = w
            for _ in 0..<z {
                if i >= arr.count {
                    oddsCounter = 0
                    break
                }
                print(" \(arr[i])")
                if arr[i] % 2 == 1 {
                    oddsCounter += 1
                }
                i+=1
            }
            print("\n")
            if oddsCounter == numOdds {
                generalCounter += 1
            }
            
        }
    }
    
    
    return generalCounter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment