HackerEarth: spartans-leonidas-vs-xerxes-monk ( DS )
HackerEarth: spartans-leonidas-vs-xerxes-monk IDEA: The problem is initially giving an array of size-N denoting power of soldiers. For every query you have to change the power of Xth index by -Y or +Y , Also, you may have to say longest increasing subarray withing segment [ x ,y ] efficiently. The idea is simple, we have to keep information of 1.)longest prefix increasing length, 2.)longest suffix increasing length, 3.)Maximum increasing length so far, 4.)begin element of segment 5.)end element of segment. Then update accordingly to get appropriate result. See the code below for further understanding. ///==================================================/// /// HELLO WORLD !! /// /// IT'S ME /// /// BISHAL GAUTAM /// /// [ bsal.gautam16@gmail.com ] /// ///==================================================/// #include<bits/stdc++.h> # defin...