Instructure Interview Question

Optimize this function in our code without knowing any context around how the actual code is built or what it is used for.