time complexity and dynamic done