2 051
Obunachilar
Ma'lumot yo'q24 soatlar
Ma'lumot yo'q7 kun
Ma'lumot yo'q30 kun
Postlar arxiv
Hi VARUN , Welcome to this Community for 2022 Batch Daily Off Campus Jobs Updates join this channel ✅
👇👇
@offcampusjobs_0
@offcampusjobs_0
02 Apr 2021, 01:35
Hi 0798 Join Our Channel for daily Off-Campus Job Updates ❤️
👇👇
@offcampusjobs_0
@offcampusjobs_0
12 Yan 2022, 04:54
Hi harry , Welcome to this Community for 2022 Batch Daily Off Campus Jobs Updates join this channel ✅
👇👇
@offcampusjobs_0
@offcampusjobs_0
02 Apr 2021, 23:09
Hi Ravi Join Our Channel for daily Off-Campus Job Updates ❤️
👇👇
@offcampusjobs_0
@offcampusjobs_0
25 Dek 2021, 22:12
Hi Jaydip Join Our Channel for daily Off-Campus Job Updates ❤️
👇👇
@offcampusjobs_0
@offcampusjobs_0
13 Yan 2022, 12:38
Hi S Join Our Channel for daily Off-Campus Job Updates ❤️
👇👇
@offcampusjobs_0
@offcampusjobs_0
10 Yan 2022, 07:08
Distinct numbers
You are given an array A consisting of N integers.
X[i] is the number of distinct values that occur to the left of index i and not on or to the right of index 1.
Y[] is the number of distinct values that occur to the right of index i and not on or to the left of index i
Task -
Determine the absolute difference of X[I], Y[I] for every index 1 ≤ i ≤ N
Example -
Assumptions:
N=5
A=[7,7,3,2,3]
Approach:
• The number of distinct elements that occur to the left of index / and not on or to the right of Index //1≤i≤N) are as follows: X = [0, 0, 1, 1, 2]
• The number of distinct elements that occur to the right of index / and not on or to the left of index // 1≤i≤N) are as follows: Y = [2, 2, 1, 0, 0]
• Therefore, the answer to this test case for every index / (1 ≤ i ≤N) are as follows: ans = (2, 2, 0, 1, 2)
Function description
Complete the function solve provided in the editor. This function takes the following parameter and returns the required answer:
N: Represents the size of the array A
A: Represents the elements of array A
Input format -
Note: This is the input format that you must use to provide custom input (available above the Compile and Test button)
The first line contains T denoting the number of test cases T also specifies the number of times you h to run the solve function on a different set of inputs
• The first line contains T denoting the number of test cases. T also specifies the number of times you have to run the solve function on a different set of inputs.
For each test case:
• The first line consisting of a single integer N denoting the size of the array A.
• The second line consisting of N space-separated integers denoting the elements of the array A
Output format -
For each test case in a new line, print a list of N space-separated integers representing the answer
Constraints:
1 ≤ T ≤ 10
1 ≤ N ≤2 * 10^5
-10^9 ≤ Ai ≤ 10^9
Code snippets (also called starter code/boilerplate code) -
Sample Input 1:
1
4
4 3 2 3
Sample Input 2:
2012
Explanation
The first line contains the number of test cases, T = 1
The first test case
Given
• N = 4
• A = [4, 3, 2, 3]
Approach
• The number of distinct elements that occur to the left of index and not on or to the right of index/(1≤i≤N) are as follows: X = [0, 1, 1, 2]
• The number of distinct elements that occur to the right of index and not on or to the left of index /(1≤i≤N) are as follows: Y = [2, 1, 0, 0]
Therefore, the answer to this test case for every index (1siN) are as follows: ans = (2, 0, 2)
26 Sen 2021, 11:05
Hi sahithi , Welcome to this Community for 2022 Batch Daily Off Campus Jobs Updates join this channel ✅
👇👇
@offcampusjobs_0
@offcampusjobs_0
03 Apr 2021, 03:13
Hi Prashant , Welcome to this Community for 2022 Batch Daily Off Campus Jobs Updates join this channel ✅
👇👇
@offcampusjobs_0
@offcampusjobs_0
03 Apr 2021, 00:43
