Этот код вносит ввод массива целых чисел, где 1 ≤ a ≤ n (n = размер массива), некоторые элементы появляются дважды, а другие появляются один раз. We have to return the missing numbers.
Input:
[4,3,2,7,8,2,3,1]
Output:
[5,6]
It works totally fine in Dev C++, but when i submit it a website called leetcode, it is giving me the following error
Runtime Error Сообщение: < /p>
строка 924: char 9: Ошибка времени выполнения: Справочная привязка с нулевым указателем типа />/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_vector.h:933:9
vector findDisappearedNumbers(vector& nums)
{
vector temp;
const int len = nums.size();
int j=0;
//sorted the array
sort(nums.begin(), nums.end());
//Added non-repetitive numbers into a temp vector
for(int i=0;i
Подробнее здесь: [url]https://stackoverflow.com/questions/61629328/why-does-this-c-code-run-on-dev-c-but-not-on-a-website[/url]
Этот код вносит ввод массива целых чисел, где 1 ≤ a [i] ≤ n (n = размер массива), некоторые элементы появляются дважды, а другие появляются один раз. We have to return the missing numbers. Input: [4,3,2,7,8,2,3,1] Output: [5,6] It works totally fine in Dev C++, but when i submit it a website called leetcode, it is giving me the following error Runtime Error Сообщение: < /p>
строка 924: char 9: Ошибка времени выполнения: Справочная привязка с нулевым указателем типа />/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_vector.h:933:9
[code]vector findDisappearedNumbers(vector& nums) { vector temp; const int len = nums.size(); int j=0; //sorted the array sort(nums.begin(), nums.end()); //Added non-repetitive numbers into a temp vector for(int i=0;i