Hola interview question

Write an extremely optimized code to switch lower case to upper case and vice versa

Interview Answer

Anonymous

Dec 1, 2017

If I understand correctly and you get a string of mixed cases and need to change them: go over the characters and check if their ascii value is between 65 and 90 (upper case) if so add 32 to make it lower case. If the value is between 97 and 122 (lower case) subtract 32 to make it an upper case otherwise leave as it is