pls answer it fast pls friends
Answers
Answer:
THE MAP IS NOT CLEAR SISO PLSS REPOST NAD ZOOM IT
Answer:
Mai yaad hoon kya?...... bohot dinn hogaya bath krke... xd
Explanation:
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int len = scan.nextInt();
int target = scan.nextInt();
int[] arr = new int[len];
for (int i = 0; i < len; i++) {
arr[i] = scan.nextInt();
}
Arrays.sort(arr);
int sum=0,count=0;
for (int i = 0; i < arr.length; i++) {
if(sum <= target){
sum += arr[i];
count++;
}
}
System.out.println(count-1);
}
}