Comment: Flipkart, Online Assessment | E-Commerce Company | Online Video streaming platf
Comment · Posted Aug 2023
void solve() { int n,m; cin>>n>>m; vector> v(n,vector(m)); cin>>v; vector ptrs(n); //used to maintain next pointers under consideration for each of the n shelves set productrange; //Used to store one item from each shelf in our range under consideration for(int i=0;i=n) break; productrange.insert({v[shelfst][ptrs[shelfst]],shelfst}); ptrs[shelfst]++; } cout<<ans.first<<" "<<ans.second<<endl; }
The full answer & interview discussion are available to premium members.
Log in Create a free account