time complexity optimization