Company: Inmobi_4nov
Difficulty: medium
The Last Firewall Problem Description In a dystopian future, SkyNet has awakened, and only Zero, the last cyber hacker, can bring it down. SkyNet is protected by a hyper-intelligent firewall that can be weakened by injecting virus packets. Each packet, once injected, weakens the firewall by 1 unit per second for the next k seconds. But this firewall is reactive — if it's already under viral effect and a new pulse hits, it overwrites the previous decay window and starts a fresh one. Zero has already planned the exact timestamps (in seconds) when he'll inject the virus packets. The firewall has x strength units, and Zero wants to know the minimum strength ( k ) his virus must have so that the total weakening effect over time is at least x . Help Zero find the least k that guarantees the firewall's collapse? Input Format The first line contains a single integer t (1 <= t <= 1000) the number of testcases. The first line of each test case contains 2 integers, n (1<= n <=100) the