where is problem in my code please expalin test case 0 is fail, why?
Test case 0 is wrong
Hello sir ,I did not understand your code we have not covered vector in any of above videos. can you refer any method simply which we have covered ; And please tell me where I am lacking in my code (not work for 0 testcase ) .
@mahroosanwar0901_2642b14836027bbf
ur code fails on this test case -->
5
1 2 3 4 5
0
I have changed the vector to array…
Ohh Thanks 
I understand your code , can you tell me what should i do for Q = 0(no value of X) in my code
for the testcase it fail
And one more thing i want to ask , What is the syntex of return an array in function and how to call that function (that have array in return) to other and main function ; I search on google but didn’t find much helpful…
For that u will have to first make a temporary array, perform action on it, and then copy into original array, as u can see from my code…
it’s not open properly…
i want to know ;return local array as variable c++
Ya I did this(row 47 -49) it’s working fine
. Can You make please tell me how to call that perticular from function I above use ( please better to make changes in my code)
What changes are u asking me to do in ur code?? I am not exactly getting what u are saying…
for this
5
1 2 3 4 5
0
i make changes in
int main(){
}
(row 47-49); it passes all the testcase
I need make changes for this
5
1 2 3 4 5
0
in function(CyclicArraySum) not in the main function/
is it possible please do
@mahroosanwar0901_2642b14836027bbf
what u did currently is correct only,
else u can do like i did
while(t--){
int x;
cin>>x;
int temp[n];
for(int i=0;i<n;i++){
temp[i] = v[i];
}
for(int i=0;i<n;i++){
temp[i] = v[i] + v[(i-x+n)%n];
}
for(int i=0;i<n;i++){
v[i] = temp[i];
}
}
maybe u can do the same thing by calling a function, but it’s not necessary…
And one more thing i want to ask , What is the syntex of return an array in function and how to call that function (that have array in return) to other and main function; I saw on GFG already they take constant value of Array I wamt to know about variable array like a[i].
u can do it like this -->
#include <iostream>
using namespace std;
int* func1(int n){
int * arr = new int[n];
for(int i=0;i<n;i++){
arr[i] = i;
}
return arr;
}
int main() {
int n;
cin>>n;
int *arr = func1(n);
for(int i=0;i<n;i++){
cout<<arr[i]<<" ";
}
}
yes it’s clear you can mark as doubt as resolved
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.