Java Program to find Second Largest Number in an Array
Solution: Before diving into the solution, let me tell you this the most common question which gets asked in the most coding rounds and if you are being lazy to practice and learn this now, you are fooling yourself. Learn the logic behind this and you'll also realize after cracking the logic of this code you have learned a beautiful algorithm from DSA, but you have to figure out that yourself. public class SecondLargestInArrayExample{ public static int getSecondLargest(int[] a, int total){ int temp; for (int i = 0; i < total; i++) { for (int j = i + 1; j < total; j++) { if (a[i] > a[j]) { ...