> Abstraction >E ncapsulation /Access Modifiers >Inheritance #include <iostream> using namespace std; class vehicle { public: vehicle() { cout<<"this is a constructor of vehicle"<<endl; } ~vehicle() { cout<<"this is a deconstructor of vehicle"<<endl; } }; class fourwheeler { public: fourwheeler() { cout<<"this is the constructor of fourwheeler"<<endl; } fourwheeler(string x) { cout<<"This is another constructor which has "<<x<<" with it"<<endl; } ~fourwheeler() { cout<<"this is deconstructor of fourwheeler"<<endl; ...
Problem Algorithm: We have to generate 10! combination of " abcdefghij " by reversing and put appropriate distance from " abcdefghij " So we need key(string)->value data structure. First thing comes to our mind is map<string,int> But it uses O(logN) time to insert a value as everything is ordered here So we use unordered_map ( Normally o(1) highest o(n) barely ) After that we take 2 string input and then find the relative string S from s1->s2 and another AC!! CODE Time needed 40-45sec .
মন্তব্যসমূহ
একটি মন্তব্য পোস্ট করুন