Urgent!!!!!! Need help in answering this question based on the information attached in the screenshot. The code should be in Java and should be able to pass all the test cases mentioned. We have to use a divide and conquer or a Greedy algorithm based on problem. Also the time complexity has to be as small as possible i.e the most optimal solution. If you use any references to get the code please link it as well. For reference this is the incomplete java code
Urgent!!!!!! Need help in answering this question based on the information attached in the screenshot. The code should be in Java and should be able to pass all the test cases mentioned. We have to use a divide and conquer or a Greedy
For reference this is the incomplete java code
import java.io.*; public class Solution { for(int i = 0; i < n; i++) { for(int i = 0; i < k; i++) { int ans = solve(n,k,f,h,hp_i,d_j); if(ans == -1){ /* Parameters: Returns the minimum T needed to defeat all enemies, or -1 if that is impossible. |
Step by step
Solved in 2 steps