How to Find the Optimal Solution for Single Number LeetCode Problem? - MrLiambi's blog

Breaking

My tweets

Advertisement

Thursday 12 August 2021

How to Find the Optimal Solution for Single Number LeetCode Problem?

Problem Specification

https://leetcode.com/problems/single-number

Solution Approaches

1. Using Brute Force

The most obvious solution is to start with a Brute Force approach. In this approach, you can compare each number with the rest of the numbers in the array. In case you find a duplicate proceed to the next number and in case you don't find a duplicate you return the current number as a Single Number. 



Source : https://dzone.com/articles/optimal-solution-single-number-leetcode-problem

No comments:

Post a Comment