Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
i learn vector. but have mistakes. i dont know where
UndefinedBehaviorSanitizer:DEADLYSIGNAL
==1==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x000002ab1000 (pc 0x0000004256b0 bp 0x000002ab0ff8 sp 0x7ffe65674d90 T1)
==1==The signal is caused by a READ memory access.
==1==WARNING: invalid path to external symbolizer!
==1==WARNING: Failed to use and restart external symbolizer!
#include
#include
using namespace std;
vector pipe_fix(const vector& nums) {
//убрать повторения
vector nums1 = nums;
for ( vector::iterator i = nums1.begin(); i != nums1.end(); ++i)
//и отсортировать
vector nums2(nums1.size()); // создаем новый вектор, там все будет отсортировано
int min = nums1[0];
vector::iterator it_min;
vector::iterator i = nums1.begin();
for ( ; i != nums1.end(); ++i)
{
for ( vector::iterator j = i+1; j != nums1.end() & i != j; ++j)
{
if ( *i < *j & *i <= min) { min = *i; it_min = i;}
if ( *i > *j & *j <= min) { min = *j; it_min = j; }
}
nums2.push_back(min);
nums1.erase(it_min);
}
nums2.push_back( *(nums.begin() ) );// в конец вектора добавляем оставшийся элемент - самый большой
//далее отсортирован и нет повторений
vector n;
n.push_back(nums2[0]);
for ( int q = 0; nums2[0] + q != *(nums2.end() - 1); ++q)
n.push_back(nums2[0] + q);
n.push_back( *(nums2.end() - 1 ));
return n;
}
That's not how vectors work. Read the documentation or make a search about this. Also, please format your code as explained there, or it's very discomfortable to read. See there: https://docs.codewars.com/training/troubleshooting/#post-discourse
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
id like to ask you again to read how to use code blocks. Did you read the link on code formatting I posted in one of your previous questions? here it is, once again: https://docs.codewars.com/references/markdown#code-block
The line you show has a syntax error and unmatched parentheses.
This comment is hidden because it contains spoiler information about the solution
Print the input when some test case fails, so you can debug your code.
Please use code blocks when posting code: https://docs.codewars.com/references/markdown#code-block
About your problem: please read description once again, carefully, and check if your solution conforms to all requirements. You can also ceck what input causes your solution to fail (see how: https://docs.codewars.com/training/troubleshooting#print-input), and recreate the failing tet in your local IDE, and debug through it.
This comment is hidden because it contains spoiler information about the solution
Mark your post as having spoiler content next time, read this: https://docs.codewars.com/training/troubleshooting/#post-discourse
This comment is hidden because it contains spoiler information about the solution
O! thank you so much!!!!!!
Loading more items...