Maximize-number-of-1s with k '0' flips

Question link: https://practice.geeksforgeeks.org/problems/maximize-number-of-1s/0
Answer Link: https://ide.codingblocks.com/s/108849

I have used Deque, altho this can be done without space but Deque operations have 0(1) time complexity
But I am getting TLE