Manmohan loves Patterns-I

import java.util.*;

class PatternI {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 1; i <= n; i++) {
if (i % 2 == 0) {
for (int j = 0; j < i; j++) {
if (j == 0 || j == i - 1) {
System.out.print(“1” + " ");
} else {
System.out.print(“0” + " ");
}
}

        } else {
            for (int j = 0; j < i; j++) {
                System.out.print("1" + " ");
            }

        }
        System.out.println();

    }
}

}
My code got only one test case passed.Please help me fixing it?

Please add the problem link so that we can help.

I think you need not print space after after each character. Thats not demanded in the sample output.

Do add the problem link, and do let me know if you have any doubts.