Examness

Intermediate Java

2 exercises · in teaching order

  1. 1Second largest valueWrite `static int secondLargest(int[] a)` returning the second largest *distinct* value. The array always holds at least two distinct values.single passsentinelsedge cases10m
  2. 2Are two words anagrams?Write `static boolean isAnagram(String a, String b)` - true when the words use exactly the same letters. Case-insensitive; assume plain a-z input.countingarrays as maps10m