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

HackerEarth Save Patients problem solution

YASH PAL, 31 July 202415 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 *

Programmingoneonone

We at Programmingoneonone, also known as Programming101 is a learning hub of programming and other related stuff. We provide free learning tutorials/articles related to programming and other technical stuff to people who are eager to learn about it.

Pages

  • About US
  • Contact US
  • Privacy Policy

Practice

  • Java
  • C++
  • C

Follow US

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