Doubt in mcq questions

Q3. Greedy3
Can greedy be used to find the minimum number of notes to make 1000 from (1,5, 7 ) rupee notes.

YES

NO

Q7. Greedy7 Predict the output : for(input 5 , 14) Double x; int y; for(i=0;i<2;i++) { cin>>y; x=(32-x)*(5/9); cout<<setprecision(3)<<x<<” ”; } 15 10 15.000 10.000 0 0

Yes, greedy will work for this specific case.
and yes the question specifically asks for this case, so the answer should be yes.
I’ll check with the problem setter.
And greedy may not always work, lets say if you want to make 10 from (1,5,7) rs notes.

Q10. Greedy10 Complexity of checking whether “hello” can be made after deleting some characters of a given string. Find min Complexity and best Algorithm. Size of hello =5 Size of given String =15 O(5) greedy O(15) DP O(5 log 15) geedy O(15) greedy

you can ask doubt by create new threads instead of asking on single doubt

okay, will do that .

1 Like