4 ms·
One approach is just to set problems that ChatGPT doesn't answer correctly. I admit that I haven't tried the following with ChatGPT 4 directly, but here's an ex
by foldr 3y ago
One approach is just to set problems that ChatGPT doesn't answer correctly. I admit that I haven't tried the following with ChatGPT 4 directly, but here's an example of Copilot screwing up:
Prompt: Write a function to swap two bigints >= 0
using only multiplication, division, addition
and subtraction, without using any
temporary storage.
function swapBigInts(a, b) {
if (a === BigInt(0) && b === BigInt(0)) {
return [a, b];
}
a = a * b;
b = a / b;
a = a / b;
return [a, b];
}
The fix for the zero cases is easy for a human to figure out. (E.g. add one to a and b at the beginning then subtract one at the end.)
- manbitesdog 3y agoJust tried with GPT and it got it right :/ There is one interview question that I could use like this tho, that involved an ASCII diagram