1. Find all possible matches in the given string for the given pattern without using regex. 2. Find intersection of two arrays. 3. Find number of bit conversion required to convert one number into another. 4. Compute all possible subsets of a string. 5. Calculate sum of first two largest numbers without using nested loops.
Anonymous
import java.util.*; import java.lang.*; import java.io.*; class fp{ public static void main (String[] args) { { int[] a1={1,2,3,8,7,5,6,4}; Arrays.sort(a1); // use to sort the array int m1=a1[a1.length-1]; int m2=a1[a1.length-2]; System.out.println("avg no is "); System.out.println(" "+m1); System.out.println(" "+m2); int b = m1 + m2; //addition of two max number in array //double avg = b/2; System.out.println(" "+b); } } }
Check out your Company Bowl for anonymous work chats.