Loading Similar Posts
// server investment
// approach
since ith network is independent from all other networks(means one network's value doesn't depend on other networks) we can handle it seperately.
to get the max number of towers we can upgrade in ith network, we can apply binary search on no of towers in ith network.
Bounds of binary search will be low=0, high=n. now we have to check if we can upgrade (mid) towers, to check the fesibility we will check if mid*upgrade[i] <= sell[i]*(num of remaining towers in the network)+money[i] is true. if it is true we will set it is as a possible solution and try for a higher value, if its false we will check for a lower value.