Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 6420 |

@blackshadows | 6376 |

@mb1973 | 5578 |

@Quandray | 5231 |

@akhayrutdinov | 5111 |

@saiujwal13083 | 4510 |

@sanjay05 | 3762 |

@kirtidee18 | 3673 |

@marius_valentin_dragoi | 3522 |

@sushant_a | 3459 |

@verma_ji | 3412 |

Complete Leaderboard | |

Handle | Score |

@codersgroup18 | 714 |

@Manikanta punnam | 579 |

@sriramgoparaju99 | 532 |

@yashkaril4 | 517 |

@praveenbgp6 | 517 |

@prankursharma31 | 489 |

@rdakka | 465 |

@sonamnigam1999 | 441 |

@purohitmn02 | 427 |

@sonamkumari63928 | 426 |

@ShubhankarPandey | 419 |

Complete Leaderboard |

Given an array **A** of **n** integers, the task is to count the number of ways to split given array elements into two disjoint groups such that XOR of elements of each group is equal.

**Note: The answer could be very large so print it by doing modulos with 10 ^{9} + 7.**

**Example 1:**

**Input :** a[] = {1, 2, 3}
**Output :** 3
**Explanation:
**{(1),(2, 3)},{(2),(1, 3)},{(3),(1, 2)}
are three ways with equal XOR
value of two groups.

**Example 2:**

**Input :** a[] = {5, 2, 3, 2}
**Output :** 0

**Your Task:**

The input is already taken care of by the driver code. You only need to complete the function **countgroup()** that takes an array **(a)**, sizeOfArray **(n)**, and return the number of ways to split an array. The driver code takes care of the printing.

**Expected Time Complexity:** O(N).

**Expected Auxiliary Space:** O(1).

**Constraints:**

1<=N<=10^{5}

1<=a<=10^{8}

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes
Split the Array

...