Java Viva: Name: Ranjit Raj UID:20BCS9943
Java Viva: Name: Ranjit Raj UID:20BCS9943
Q2.Given an array of size N-1 such that it only contains distinct integers in the range of 1
to N. Find the missing element
CODE:
package com.company;
import java.util.Arrays;
class Main
{
int n = arr.length;
int m = n + 1;
int total = m * (m + 1) / 2;
OUTPUT: