I couldn't understand the description at all, so I solved it by only looking at test cases, lmao.
Oh you're right, my bad, I thought I had resetted code to the initial one but I actually did not. Sorry...
Did you modify the signature of the function? It should be std::vector<int> replacement(const std::vector<int> &arr)
std::vector<int> replacement(const std::vector<int> &arr)
In C++ I always get
/tmp/main-6d2b51.o: In function `do_test(std::vector<int, std::allocator<int> > const&, std::vector<int, std::allocator<int> > const&)':
main.cpp:(.text+0x11): undefined reference to `replacement(std::vector<int, std::allocator<int> > const&)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Is the fault mine? If so, what's the problem?
Could you please provide any description option, which would be understandable for you?
thanks and sorry for the fake alert
I am a beginner and this indexing situation with 1 got me confused
Are you certain you are reading the test output correctly?
For clarification: the tests return a failed result in as <your result> should equal <expected result. The first bit is not the input . It is the value returned by your solution.
<your result> should equal <expected result
Dear @arhigod or whoever handles this!
The python tests are not working properly.
Test says that it will test 2,3,4,1 and expects 4,1,2,3 but the output gives error saying 1,4,2,3 should turn into 4,1,2,3.
Please fix so I can submit and finish this.
Really difficult to understand :) The 1-based indexing puts even more confusion on top of everything.
Input contains array with N integers: the i-th number is j - the number of a friend who gave a gift to friend number i.
Return array with N integers: the i-th number should equal the number of the friend who gave a gift to friend number i.
So return the exact same array then.
The description needs reformulating. Personally I find that there's quite a bit annoying extra information in it too.
I think it would be clearer if you described the i-th number in both cases.
This comment is hidden because it contains spoiler information about the solution
No, in input:
j(arr[j]) "- the number of a friend who was given a gift by friend number i", but in output:
i(arr[i]) "- the number of a friend who was given a gift by friend number i"