Write an Efficient Method to Check if a Number is Multiple of 3 | GeeksforGeeks

preview_player
Показать описание

This video is contributed by komal kungwani.

Please Like, Comment and Share the Video among your friends.

Install our Android App:

If you wish, translate into local language and help us reach millions of other geeks:

Follow us on Facebook:

And Twitter:

Also, Subscribe if you haven't already! :)
Рекомендации по теме
Комментарии
Автор

Please increase the audio.. Its very low...

PraveenKumar-ftkr
Автор

For all those who are saying use modulo what if the input is given in binary form and cant be converted because it is too large and 64 bit integer can't store it . then also this method can work as unlike integers binary string can store much larger integers

aman-tlgd
Автор

Is it efficient to do arithmetic operations in the bits level?

vivekanandhvjs
Автор

this is a clever solution. I figured the answer was pattern-based (after writing out a table of multiples of 3) but didn't manage to get to difference of even and odd bit counts before clicking on the video for the solution.

However, as smart as this is, the solution is not as efficient on a modern iA64 architecture processor as simply doing an IDIV instruction and checking the remainder (EDX/DX/AH) for zero (after doing a couple of moves and a CBW/CWD/CDQ instruction).

xf
Автор

Don't know how this video is approved for uploading on official gfg channel, such a shame, like can anyone upload video here with terrible quality

jitendrasinghsola