Pretty nice hints, only thing I got wrong were states for DP. Can you tell me reason to take [i][j] there and why not [k] where k indicates if the element was added to increasing or decreasing sequence or none
Pretty nice hints, only thing I got wrong were states for DP. Can you tell me reason to take [i][j] there and why not [k] where k indicates if the element was added to increasing or decreasing sequence or none
I am here trying to solve problem in O(n) space,
I don't know why my code gives me few WAs, well do we nee dto keep track of diagonal values? As my code doesn't deos that. If yes, why?
#include<iostream>
using namespace std;
int max(int a,int b){
if(a>b) return a;
return b;
}
int main(){
int size;