Table of Contents

## What is sub array in C?

A subarray is commonly defined as a part or section of an array. An array is a set of variables that a programmer defines collectively. Instead of creating separate variables, the programmer can declare a single array with multiple values labeled.

**How do you find the sub array of an array?**

Algorithm:

- Traverse the array from start to end.
- From every index start another loop from i to the end of array to get all subarray starting from i, keep a variable sum to calculate the sum.
- For every index in inner loop update sum = sum + array[j]
- If the sum is equal to the given sum then print the subarray.

### How do you create a sub array?

Generating subarrays using recursion

- Stop if we have reached the end of the array.
- Increment the end index if start has become greater than end.
- Print the subarray from index start to end and increment the starting index.

**What is sub array and subsequence?**

A subarray is a contiguous part of array and maintains relative ordering of elements. For an array/string of size n, there are n*(n+1)/2 non-empty subarrays/substrings. A subsequence maintain relative ordering of elements but may or may not be a contiguous part of an array.

## How do you find the MEX of an array?

Note: The MEX of an array is equal to the smallest positive integer that is not present in the array. For example, MEX(1,2,4,2,3,6,7) = 5. The ﬁrst line contains a single integer t denoting the number of test cases.

**Are Subsequences and subsets same?**

Subsequence: Need not to be contiguous, but maintains order i.e. Subset: Same as subsequence except it has empty set i.e. Show activity on this post. Consider these two properties in collection (array, sequence, set, etc) of elements: Order and Continuity.

### How do I print a sub array?

Approach:

- Use three nested loops.
- Outer loops will decide the starting point of a sub-array, call it as startPoint.
- First inner loops will decide the group size (sub-array size).
- The most inner loop will actually print the sub-array by iterating the given array from startPoint and print the next grps elements.

**What is subsequence array?**

A subsequence of an array is an ordered subset of the array’s elements having the same sequential ordering as the original array.

## What is the mex of the string?

MEX of a binary string is defined as a number x such that all no. from 0 to x-1 are present as subsequence in its binary representation (without leading zeroes) in the string. Given a binary string s, Output MEX(s) (without leading zeroes) in binary format.

**How do you find the MEX of a set?**

Note:- The MEX of a set of integers is the minimum non-negative integer that doesn’t exist in it. For example, the MEX of the set {0, 2, 4} is 1 and the MEX of the set {1, 2, 3} is 0. Examples : Input : n = 5, x = 3 0 4 5 6 7 Output : 2 The MEX of the set {0, 4, 5, 6, 7} is 1 which is not equal to 3.

### How many Subarrays are in an array?

The total number of subarrays in an array of size N is N * (N + 1) / 2. The count of subarrays with an odd product is equal to the total number of continuous odd elements present in the array.

**How to initialize an array in C?**

Initializer List: To initialize an array in C with the same value,the naive way is to provide an initializer list.

## How to declare and initialize array in a class?

The value,Quincy is at index 0

**What are dynamic arrays in C#?**

Concept of Jagged Arrays. A Jagged Array is an array of arrays.

### What is array in C programming language?

In C and C++ Using the array access notation is natural. De-allocation is performed thus: delete[] pointer; pointer = NULL; Again, assigning NULL to the pointer after deallocation is just good programming practice.