Single Number II [LeetCode][June Challenge]

Given a non-empty array of integers, every element appears three times except for one, which appears exactly once. Find that single one.

Note:

Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?

Example 1:

Input: [2,2,3,2]
Output: 3

Example 2:

Input: [0,1,0,1,0,1,99]
Output: 99

Solution:

--

--

--

I am Indian by birth, Punjabi by destiny. Humanity is my religion. Love to eat, travel, read books and my million dreams keep me alive.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to create an Alexa skill with Node.js and DynamoDB

Cross-Platform TUI Apps in Clipper 5? You betcha!

A New Expedition — Open Source

Open source meme

Agile reviews: How we adapted an engineering best practice

THE SUMMONER ERA — WINNING RACE: 🏁ROUND 1

Ontruck’s approach to optimizing European freight transportation

A Study Notes of Exploit Spring Boot Actuator

Audio & Video Drift Correction Cookbook

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Navneet Ojha

Navneet Ojha

I am Indian by birth, Punjabi by destiny. Humanity is my religion. Love to eat, travel, read books and my million dreams keep me alive.

More from Medium

[Leetcode] 705. Design HashSet 문제 풀이

How To Raise Really Good Pull Requests(PR)

Solve Top LeetCode Problem Smartly

Merge Sort for Linked Lists