Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <h1>Paireds and Unpaireds</h1>




- You have 1 hour to complete the task.
- You will be recorded, so please remember to explain the code you do.
- Starting by the design of your solution is a good approach. Don't jump into code immediatly.
- Since no one will resolve questions while you are coding, make assumptions and explain them.
- Once you complete the code, please send it by email to the person guiding your session.
- You can use console (F12) to check your results

An array consisting of integers is given. Each element of the array can be paired with another element that has the same value, except for one element that is left unpaired.

For example, in array such this: [1, 2, 2]
Elements at indexes 1 and 2 are paired
Element at index 0 has value 1 and is unpaired.

Write a function:
function findUnpairElement(array)

It will return 1 for the sample above. 

* Unexpected things might happen, you should decide what to do if the Array contains invalid data.*

Array size range is 0..1,000,000, this means:
Array might have no data
Array might have up to 1 million elements, therefore performance is key in your solution.


 * @param array - Array with Paireds and Unpaired (and maybe some unexpected stuff)
 * @returns {number} Unpaired Element
function findUnpairElement(array){

	// In case is not an Array
	if (!Array.isArray(array)) return false;

  return (array).reduce((a, b) => a ^ b);


console.log(findUnpairElement()); //what about this case? keep it in mind
console.log(findUnpairElement('I dont belong here')); //what about this case? keep it in mind