Skip to content
Programmingoneonone
Programmingoneonone
  • CS Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
    • Cybersecurity
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
  • Work with US
Programmingoneonone
Programmingoneonone

HackerEarth Save Patients problem solution

YASH PAL, 31 July 202411 February 2026
In this HackerEarth Save Patients problem solution, A new deadly virus has infected large population of a planet. A brilliant scientist has discovered a new strain of virus which can cure this disease. Vaccine produced from this virus has various strength depending on midichlorians count. A person is cured only if midichlorians count in vaccine batch is more than midichlorians count of person. A doctor receives a new set of report which contains midichlorians count of each infected patient, Practo stores all vaccine doctor has and their midichlorians count. You need to determine if doctor can save all patients with the vaccines he has. The number of vaccines and patients are equal.
HackerEarth Save Patients problem solution

HackerEarth Save Patients problem solution.

#include <bits/stdc++.h>

using namespace std;

int vaccine [100000 + 10];
int patient [100000 + 10];

int main()
{
ios::sync_with_stdio(false);cin.tie(0);
int n;

cin >> n ;

for(int i = 0; i < n; i++) cin >> vaccine[i];
for(int i = 0; i < n; i++) cin >> patient[i];

sort(patient, patient + n);
sort(vaccine, vaccine + n);

for(int i = 0; i < n; i++){

if(vaccine[i] <= patient[i]){

cout << "No";
return 0;
}
}

cout << "Yes";

return 0;
}
coding problems solutions HackerEarth HackerEarth

Post navigation

Previous post
Next post

Leave a Reply

Your email address will not be published. Required fields are marked *

Pages

  • About US
  • Contact US
  • Privacy Policy

Follow US

  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2026 Programmingoneonone | WordPress Theme by SuperbThemes