Problem4 tempt to improve performance

Problem4 tempt to improve performance of method1 but failure