Posts

Roy and Profile Picture hackerearth question solution

Roy and Profile Picture HackerEarth question solution Question -                                 Roy wants to change his profile picture on Facebook. Now Facebook has some restrictions over the dimension of a picture that we can upload. The minimum dimension of the picture can be  L x L , where  L  is the length of the side of the square. Now Roy has  N  photos of various dimensions. The dimension of a photo is denoted as  W x H where  W  - width of the photo and  H  - Height of the photo When any photo is uploaded following events may occur: [1] If any of the width or height is less than L, a user is prompted to upload another one. Print " UPLOAD ANOTHER " in this case. [2] If width and height, both are large enough and (a) if the photo is already square then it is accepted. Print " ACCEPTED " in this case. (b) else user is prompted to...

How to use Sort function in c++ language and sort the array element

Use Sort( ) Function in c++ Language As we know, when we sort the array element, we use the 5 to 6 line write and we increase the time complexity in our code so the solution is that  we use the sort( ) which is one of the functions of Algorithm header file Syntax of Sort( ) function -       Sort( first element address, last element or contiguous location element address) Code -  #include <iostream> #include<algorithm> using namespace std; int main() {     int n;     cout<<"Enter a number: ";     cin>>n;     int a[n];     cout<<"Enter a "<<n<<" number: ";     for(int i=0;i<n;i++)     {         cin>>a[i];     }     cout<<"Your sort element is : ";     sort(a, a+n);     for(int i=0;i<n;i++)     {         cout...

Back to School | Basic of Input/Output Problem | Hackerearth Solution

Back to School Problem -                       In our school days, all of us have enjoyed the Games period. Raghav loves to play cricket and is Captain of his team. He always wanted to win all the cricket matches. But only one last Games period is left in school now. After that, he will pass out from school. So, this match is very important to him. He does not want to lose it. So he has done a lot of planning to make sure his teams win. He is worried about only one opponent - Jatin, who is a very good batsman. Raghav has figured out 3 types of bowling techniques, that could be most beneficial for dismissing Jatin. He has given points to each of the 3 techniques. You need to tell him which is the maximum point value so that Raghav can sele ct the best technique. 3 numbers are given in input. Output the maximum of these numbers. Input: Three space-separated integers. Output: Maximum integer value ...