//Used for level 2 of that day private bool IsValidPasswordExtended(Level2Input passwordInput) { //not zero index because we have a space at pos 0 and i am too lazy to fix bool lowcorrect = passwordInput.password[passwordInput.lowerRange].Equals(passwordInput.passwordChar); bool highcorrect = passwordInput.password[passwordInput.higherRange].Equals(passwordInput.passwordChar); if (highcorrect || lowcorrect) { return(highcorrect != lowcorrect); } return(false); }
private bool IsValidPassword(Level2Input passwordInput) { var count = passwordInput.password.Count(character => character.Equals(passwordInput.passwordChar)); return(count >= passwordInput.lowerRange && count <= passwordInput.higherRange); }