# Untitled

unknown
plain_text
3 years ago
2.7 kB
1
Indexable
Never
```import Foundation
class Solution {
var stepsNeeded = 0
let minimumChar = 6
let maximumChar = 20

if !oneUpperLetterExist() {
stepsNeeded += 1
}

if !oneLowerLetterExist() {
stepsNeeded += 1
}

if !oneDigitExist() {
stepsNeeded += 1
}

print(stepsNeeded)

let array = threeRepeatingCharacterCount()
print(array)
for rep in array {
stepsNeeded += (rep - 2)
}

print(stepsNeeded)

if !minimumCharacterExists() {

if count > maximumChar {
stepsNeeded = count - maximumChar
}
else if count < minimumChar {
stepsNeeded = minimumChar - count
}
}

return stepsNeeded
}

func minimumCharacterExists()-> Bool {
}
func oneUpperLetterExist()-> Bool {
let uppercaseLetters = CharacterSet.uppercaseLetters
return lettersRange != nil
}
func oneLowerLetterExist()-> Bool {
let lowercaseLetters = CharacterSet.lowercaseLetters
return lettersRange != nil
}
func oneDigitExist()-> Bool {
let decimalCharacters = CharacterSet.decimalDigits
return decimalRange != nil
}
func threeRepeatingCharacterCount()-> [Int] {
var repeatingCharactersCount = [Int]()
var repeatingCharacters = [Character]()

var firstIndex = passRef.startIndex
while (firstIndex != passRef.endIndex) {

var secondIndex = passRef.index(after: firstIndex)
var count = 0
while (secondIndex != passRef.endIndex) {
if (passRef[firstIndex] == passRef[secondIndex]) {
count += 1
}
secondIndex = passRef.index(after: secondIndex)
}

repeatingCharactersCount.append(count)
count = 0
firstIndex = passRef.index(after: firstIndex)
}
return repeatingCharactersCount
}

}