Back to course home
0% completed
Vote For New Content
Introduction to Bitwise XOR Pattern
XOR is a logical bitwise operator that returns 0 (false) if both bits are the same and returns 1 (true) otherwise. In other words, it only returns 1 if exactly one bit is set to 1 out of the two bits in comparison.
It is surprising to know the approaches that the XOR operator enables us to solve certain problems. For example, let’s take a look at the following problem:
Given an array of
n-1integers in the range from1ton, find the one number that is missing from the array.
Example:
Input: 1, 5, 2, 6, 4
Answer: 3
.....
.....
.....
Like the course? Get enrolled and start learning!