memesearch
ChatGPT Fails at Missing Numbers

ChatGPT Fails at Missing Numbers

Download Find similar pictures
Text on the meme
Good! All the same but there are two absent numbers and numbers is unsigned integer. Try to solve it with better complexity. Here's an implementation in C++20 that can find the two missing numbers in an array containing numbers from 0 to n, where two numbers are missing and the numbers are unsigned integers: #include <cmath> #include <vector> std::pair<unsigned int, unsigned int> findMissingNumbers(const std::vector<unsigned int>& nums, unsigned int n) { unsigned int missingXor = 0; for (unsigned int i = 0; i <= n; i++) { missingXor ^= i; } for (const auto num : nums) { missingXor ^= num; } unsigned int rightMostBit = missingXor & ~(missingXor - 1); unsigned int missing1 = 0, missing2 = 0; for (const auto num : nums) { if (num & rightMostBit) { missing1 ^= num; } else { missing2 ^= num; } } for (unsigned int i = 0; i <= n; i++) { if (i & rightMostBit) { missing1 ^= i; } else { missing2 ^= i; } } return {missing1, missing2}; }
What it means

На скриншоте показан диалог с ChatGPT: пользователь просит найти два пропущенных числа в массиве с лучшей сложностью, уточняя, что числа имеют беззнаковый целочисленный тип. ChatGPT выдаёт реализацию на C++20, но использует сомнительную логику для unsigned integer и не демонстрирует честную radix sort, поэтому это высмеивает самоуверенный ответ ИИ на сложную задачу. EN: The screenshot shows a chat with ChatGPT: the user asks how to find two missing numbers in an array with better complexity, specifying that the numbers are unsigned integers. ChatGPT provides a C++20 implementation, but its logic for unsigned integers is questionable and it does not demonstrate an honest radix sort, mocking an overconfident AI answer to a difficult problem.

Objects
Tags
Source
Type
image
Size
566×800 · 48.3 KiB
Mood
sarcastic, absurd
Language
en
Added