We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
#include<bits/stdc++.h>usingnamespacestd;intA[100008],n;/* * Complete the 'solve' function below. * * The function is expected to return a STRING_ARRAY. * The function accepts following parameters: * 1. INTEGER_ARRAY arr * 2. 2D_INTEGER_ARRAY queries */intmain(){cin>>n;for(inti=1;i<=n;i++){cin>>A[i];}intq;cin>>q;for(inti=0;i<q;i++){intx,y;cin>>x>>y;if(A[x+1]==0&&x<y){cout<<"Odd"<<endl;}else{if(A[x]%2==0){cout<<"Even"<<endl;}else{cout<<"Odd"<<endl;}}}return0;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Even Odd Query
You are viewing a single comment's thread. Return to all comments →