Ugly numbers not passing

import java.util.;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- != 0) {
int n = sc.nextInt();
int[] ugly = new int[n];
ugly[0] = 1;
int i2 = 0, i3 = 0, i5 = 0;
int f2 = 2, f3 = 3, f5 = 5;
for(int i=1;i<n;i++){
int min = Math.min(Math.min(f2,f3),f5);
ugly[i] = min;
if(f2 == min)
f2 = 2
ugly[++i2];
if(f3 == min)
f3 = 3ugly[++i3];
if(f5 == min)
f5 = 5
ugly[++i5];
}
System.out.println(ugly[n-1]);
}

}

}

your submissions show that you have scored 100!
great job :slight_smile: please mark your doubt as resolved !