import java.util.;
import java.lang.;
import java.io.*;
import java.math.BigInteger;
public class solution {
public static void oddCount(List < String > substr) {
int oddone = 0;
int oddzero = 0;
for (int i = 0; i < substr.size(); i++) {
List < String > myList = new ArrayList < String > (Arrays.asList(substr.get(i).split("")));
int zero = Collections.frequency(myList, "0");
if (zero % 2 == 1)
oddzero++;
int one = Collections.frequency(myList, "1");
if (one % 2 == 1)
oddone++;
}
System.out.println(oddzero + " " + oddone);
}
public static void SubString(String str) {
List < String > temp = new ArrayList < > ();
int n = str.length();
for (int i = 0; i < n; i++)
for (int j = i + 1; j <= n; j++)
temp.add(str.substring(i, j));
oddCount(temp);
}
public static void main(String[] args) {
List < String > values = new ArrayList < > ();
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
while (scanner.hasNext()) {
values.add(String.valueOf(scanner.next()));
}
scanner.close();
for (int i = 0; i < n; i++) {
BigInteger num = new BigInteger(values.get(i));
SubString(num.toString(2));
}
}
}
path – actual dialog field path which need to be reused in the different component, above xml forms the node in the crx/de as shown below and the cq:dialog field
import java.util. * ;
import java.lang. * ;
import java.io. * ;
public class solution {
private static int[][] grid;
private static int a;
private static int b;
public static int rightNav(int r, int c, int init, boolean flag) {
int i, j;
if ((r < a) && (c < b)) {
if (!isPrime(grid[r][c], flag) && grid[r][c] != 0) {
init = 1;
for (i = r; i < r + 1; i++) {
for (j = c; j < b; j++) {
if (r < a) {
if (!isPrime(grid[i][j], flag) && grid[i][j] != 0) {
grid[i][j] = 0;
if (i > 0) upNav(i - 1, j, flag);
if (i + 1 < a) downNav(i + 1, j, flag);
} else break;
}
}
}
}
}
return init;
}
public static void rightNav(int r, int c, boolean flag) {
int i, j;
if ((r < a) && (c < b)) {
if (!isPrime(grid[r][c], flag) && grid[r][c] != 0) {
for (i = r; i < r + 1; i++) {
for (j = c; j < b; j++) {
if (r < a) {
if (!isPrime(grid[i][j], flag) && grid[i][j] != 0) {
grid[i][j] = 0;
if (i > 0) {
upNav(i - 1, j, flag);
}
if (i + 1 < a) downNav(i + 1, j, flag);
} else break;
}
}
}
}
}
}
public static void leftNav(int r, int c, boolean flag) {
int i, j;
if ((r < a) && (c < b)) {
if (!isPrime(grid[r][c], flag) && grid[r][c] != 0) {
for (i = r; i < r + 1; i++) {
for (j = c; j >= 0; j--) {
if (r < a) {
if (!isPrime(grid[i][j], flag) && grid[i][j] != 0) {
grid[i][j] = 0;
if (i > 0) upNav(i - 1, j, flag);
if (i + 1 < a) downNav(i + 1, j, flag);
} else break;
}
}
}
}
}
}
public static void downNav(int r, int c, boolean flag) {
int i, j;
if ((r < a) && (c < b)) {
if (!isPrime(grid[r][c], flag) && grid[r][c] != 0) {
for (i = c; i < c + 1; i++) {
for (j = r; j < a; j++) {
if (c < b) {
if (!isPrime(grid[j][i], flag) && grid[j][i] != 0) {
grid[j][i] = 0;
if (i > 0) leftNav(j, i - 1, flag);
if (i + 1 < b) rightNav(j, i + 1, flag);
} else break;
}
}
}
}
}
}
public static void upNav(int r, int c, boolean flag) {
int i, j;
if ((r < a) && (c < b)) {
if (!isPrime(grid[r][c], flag) && grid[r][c] != 0) {
for (i = c; i < c + 1; i++) {
for (j = r; j >= 0; j--) {
if (c < b) {
if (!isPrime(grid[j][i], flag) && grid[j][i] != 0) {
grid[j][i] = 0;
if (i > 0) leftNav(j, i - 1, flag);
if (i + 1 < b) rightNav(j, i + 1, flag);
} else break;
}
}
}
}
}
}
public static void comNavigate(boolean diff) {
int flag = 0, count = 0, i, j;
for (i = 0; i < a; i++) {
for (j = 0; j < b; j++) {
flag = 0;
flag = rightNav(i, j, 0, diff);
if (flag == 1) count++;
}
}
System.out.print(count + " ");
}
public static boolean isPrime(int num, boolean flag) {
for (int i = 2; i <= num / 2; ++i) {
if (num % i == 0) {
flag = !flag;
break;
}
}
return flag;
}
public static void multiDimension(List < Integer > table) {
a = table.get(0);
b = table.get(1);
table.remove(0);
table.remove(0);
int i, j;
grid = new int[a][b];
int k = 0;
for (i = 0; i < a; i++) {
for (j = 0; j < b; j++) {
grid[i][j] = table.get(k);
k++;
}
}
comNavigate(false);
comNavigate(true);
System.out.println();
}
public static void main(String[] args) {
List < Integer > values = new ArrayList < >();
List < Integer > temp = new ArrayList < >();
Scanner scanner = new Scanner(System. in );
int n = scanner.nextInt();
while (scanner.hasNext()) {
values.add(Integer.valueOf(scanner.next()));
}
scanner.close();
int q = 0, j;
for (int i = 0; i < n; i++) {
for (j = q; j < (values.get(q) * values.get(q + 1) + 2 + q); j++) {
temp.add(values.get(j));
if (temp.size() == values.get(q) * values.get(q + 1) + 2) {
multiDimension(temp);
}
}
temp.clear();
q += values.get(q) * values.get(q + 1) + 2;
}
}
}
Continuously participates in programming hackathons or competitive programming, conducted online on various platforms (TechGig, HackerRank, HackerEarth, SkillEnza), includes hiring challenges will post here what all the problems I have solved along with the solutions in Java
People can post their problem here so that I will be able to give you the solution and also I can learn
Why do this?
Because many beginners are afraid to give their first programming challenge, once they get the references online they will be able to cope up with the circumstances
Because it will help me to keep the track of my own activities which are worth sharing