[code lang=”java”] public class DuplicateInArray { public static void main(String[] args) { System.out.println(isDuplicate(new int[]{2, 16, 9, 2, 6})); } public static boolean isDuplicate(int[] nums) { boolean status = false; Arrays.sort(nums); int i = 0; while (i < nums.length – 1)
Tag: array
How to find the missing number in integer array of a given range?
Check Out the example bellow: [code lang=”java”] public class MissingNumber { public static void main(String args[]) { System.out.println(Arrays.toString(getMissingNumber(new int[]{1, 2, 3, 9, 8, 11, 15, 14, 20}, 20))); } /** * * @param numbers * @param count * @return *