We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7c0f0d2 commit f210785Copy full SHA for f210785
InterviewPrograms/src/com/java/array/SecondMinimum.java
@@ -14,7 +14,17 @@
14
* The solution is, declare two variables
15
* one variable to store minimum in the array
16
* another variable to store second minimum
17
+*
18
+* assume 0th index value is minimum value
19
+* and 1st index value is 2nd min value
20
+* then iterate the array from index 2 to n
21
+* compare every index value with min variable
22
+* if it is less than min variable
23
+* then update both min and second min
24
*
25
+* else check the ith value is less
26
+* than 2nd min, if it so,
27
+* then update only 2nd min variable with ith value
28
*/
29
public class SecondMinimum {
30
public static void main(String[] args) {
0 commit comments