Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
MinMaxArray
//'main' method must be in a class 'Rextester'. //openjdk version '11.0.5' import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { int[] arr = {1000, 11, 445, 1, 330, 3000}; int min; int max = arr[0]; min = arr[0]; for(int loop:arr){ if(loop>min) max = loop; else min = loop; } System.out.println(min+" "+max); } }
run
|
edit
|
history
|
help
0
linkl
Problem: rstring
Basic tree implementation
++a vs a++ and calculations around different variables
"Naive" recursion vs. Dynamic Programming
namingVariables
home by stars
java palindrome check
Street light
Document management system - build unordered list (table of contents) recursively