GoDaddy Online Inclusive Hackathon Assessment – DSA Question

Posted
2 Nov 2026
0 reads

Summary

I participated in GoDaddy's online inclusive hackathon assessment, which had 18 questions (16 MCQs and 2 DSA problems). I was able to solve the task scheduling problem but could not solve the XOR subsets problem.

How it went

The assessment consisted of 18 questions in total:

16 Multiple Choice Questions (MCQs).

2 Data Structures and Algorithms (DSA) questions.

DSA Questions

Question 1: Task Scheduling with Cooling Period

A medium-level problem based on completing tasks with a given cooling period between consecutive executions of the same task.

I was able to work on this problem.

Question 2: Count Subsets with a Given XOR for Multiple Queries

I couldn't solve this question during the assessment.

Problem Statement

You are given an array of integers arr of size n and q queries.

Each query consists of two integers:

  • end: The ending index of the prefix to consider.
  • k: The target XOR value.

For each query, count the number of subsets that can be formed using the elements from index 0 to end (inclusive) such that the bitwise XOR of all elements in the subset equals k.

Input

  • An integer array arr of size n.
  • An integer q, representing the number of queries.
  • Each query contains two integers, end and k.

Output

For each query, output the number of subsets of the prefix arr[0...end] whose elements have a bitwise XOR equal to k.

Constraints

  • 1 ≤ n ≤ 10⁵
  • 1 ≤ q ≤ 10⁵

The constraints on the array elements and target XOR values were not specified.

Example

Input:

arr = [1, 2, 3]
q = 2
queries = [(1, 3), (2, 0)]

Output:

1
2

Explanation:

For arr = [1, 2, 3], consider the following queries.

Query 1: (1, 3)

The ending index is 1, so the prefix is [1, 2].

All possible subsets:

SubsetXORMatches target (3)?
{}0No
{1}1No
{2}2No
{1, 2}1 ^ 2 = 3Yes

Answer = 1

Query 2: (2, 0)

The ending index is 2, so the prefix is [1, 2, 3].

All possible subsets:

SubsetXORMatches target (0)?
{}0Yes
{1}1No
{2}2No
{3}3No
{1, 2}3No
{1, 3}2No
{2, 3}1No
{1, 2, 3}1 ^ 2 ^ 3 = 0Yes

Answer = 2

Therefore, the output is:

1
2

Note: This assumes the empty subset is allowed and each subset is counted once.

Questions asked (1)

  1. 01

    Count Subsets with a Given XOR for Multiple Queries

    Data Structures & Algorithms

    You are given an array of integers arr of size n and q queries.

    Each query consists of two integers:

    • end: The ending index of the prefix to consider.
    • k: The target XOR value.

    For each query, count the number of subsets that can be formed using the elements from index 0 to end (inclusive) such that the bitwise XOR of all elements in the subset equals k.

    Input

    • An integer array arr of size n.
    • An integer q, representing the number of queries.
    • Each query contains two integers, end and k.

    Output For each query, output the number of subsets of the prefix arr[0...end] whose elements have a bitwise XOR equal to k.

    Constraints

    • 1 ≤ n ≤ 10⁵
    • 1 ≤ q ≤ 10⁵

    Example

    arr = [1, 2, 3]
    q = 2
    queries = [(1, 3), (2, 0)]
    

    Output

    1
    2
    

    The problem asks to count subsets of a prefix of the array whose XOR equals a target value.

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Godaddy recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!