Java, 82 bytes
void f(int[]a){int m=a[0];for(int n:a){System.out.print(m>n?"":n+" ");m=n>m?n:m;}}
Here's a simple output loop. It just keeps the max in m
and compares each element.
void f(int[]a){int m=a[0];for(int n:a){System.out.print(m>n?"":n+" ");m=n>m?n:m;}}
Here's a simple output loop. It just keeps the max in m
and compares each element.