Check If N and Its Double Exist | Special Motivation | Leetcode 1346 | codestorywithMIK

Subscribers:
92,300
Published on ● Video Link: https://www.youtube.com/watch?v=zslzulWjOV4



Duration: 0:00
4,277 views
272


Whatsapp Community Link : https://www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A
This is the 59th Video of our Playlist "Leetcode Easy" by codestorywithMIK

In this video we will try to solve an easy array problem : Check If N and Its Double Exist | Special Motivation | Multiple Approaches | Leetcode 1346 | codestorywithMIK
We will solve using multiple approaches.

I will explain the intuition so easily that you will never forget and start seeing this as cakewalk EASYYY.
We will do live coding after explanation and see if we are able to pass all the test cases.
Also, please note that my Github solution link below contains both C++ as well as JAVA code.

Problem Name : Check If N and Its Double Exist | Special Motivation | Multiple Approaches | Leetcode 1346 | codestorywithMIK
Company Tags : will update later
My solutions on Github(C++ & JAVA) - https://github.com/MAZHARMIK/Interview_DS_Algo/blob/master/Arrays/Leetcode Easy/Check If N and Its Double Exist.cpp
Leetcode Link : https://leetcode.com/problems/check-if-n-and-its-double-exist


My DP Concepts Playlist :    • Roadmap for DP | How to Start DP ? | ...  
My Graph Concepts Playlist :    • Graph Concepts & Qns - 1 : Graph will...  
My Recursion Concepts Playlist :    • Introduction | Recursion Concepts And...  
My GitHub Repo for interview preparation : https://github.com/MAZHARMIK/Interview_DS_Algo
Instagram : https://www.instagram.com/codestorywithmik/
Facebook : https://www.facebook.com/people/codestorywithmik/100090524295846/
Twitter : https://twitter.com/CSwithMIK
Subscribe to my channel :    / @codestorywithmik  

╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝

Summary :
Approach-1 (Brute Force)

Time Complexity: O(n²)
Space Complexity: O(1)
This approach uses two nested loops to compare every pair of elements in the array. For each pair, it checks if one element is double the other. While simple, it is inefficient for larger arrays due to the O(n²) time complexity.
Approach-2 (Using Extra Space)

Time Complexity: O(n)
Space Complexity: O(n)
This approach uses a HashSet to store elements as we traverse the array. For each element, it checks if twice the element or half the element (if it’s even) already exists in the set. This reduces the time complexity to O(n), but it requires extra space to store the elements in the set.
Approach-3 (Using Binary Search)

Time Complexity: O(n log n)
Space Complexity: O(1)
In this approach, the array is first sorted, and then for each element, binary search is used to find if the doubled value exists in the array. Sorting takes O(n log n) time, and binary search for each element takes O(log n) time. This approach has a better time complexity compared to brute force, but it still requires sorting, which adds overhead. The space complexity is O(1) since no extra space other than the input array is used.

✨ Timelines✨
00:00 - Introduction

#MIK #mik #Mik
#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #coding #programming #100daysofcode #developers #techjobs #datastructures #algorithms #webdevelopment #softwareengineering #computerscience #pythoncoding #codinglife #coderlife #javascript #datascience #leetcode #leetcodesolutions #leetcodedailychallenge #codinginterview #interviewprep #technicalinterview #interviewtips #interviewquestions #codingchallenges #interviewready #dsa #hindi #india #hindicoding #hindiprogramming #hindiexplanation #hindidevelopers #hinditech #hindilearning #helpajobseeker #jobseekers #jobsearchtips #careergoals #careerdevelopment #jobhunt #jobinterview #github #designthinking #learningtogether #growthmindset #digitalcontent #techcontent #socialmediagrowth #contentcreation #instagramreels #videomarketing #codestorywithmik #codestorywithmick #codestorywithmikc #codestorywitmik #codestorywthmik #codstorywithmik #codestorywihmik #codestorywithmiik #codeistorywithmik #codestorywithmk #codestorywitmick #codestorymik #codestorwithmik




Other Videos By codestorywithMIK


2024-12-08Sorry System Stack 🥹
2024-12-07Primality Check | Sieve of Eratosthenes | Super Detailed For Beginners | codestorywithMIK
2024-12-07Special Array II | 3 Detailed Approaches | Beginners Alert | Leetcode 3152 | codestorywithMIK
2024-12-06Two Best Non-Overlapping Events | Brute Force | Better | Leetcode 2054 | codestorywithMIK
2024-12-05Minimum Limit of Balls in a Bag | Detailed | Why Binary Search | Leetcode 1760 | codestorywithMIK
2024-12-04Maximum Number of Integers to Choose From a Range I | Simple | Leetcode 2554 | codestorywithMIK
2024-12-03Move Pieces to Obtain a String | Brute Force | Wrong | Optimal | Leetcode 2337 | codestorywithMIK
2024-12-02Make String a Subsequence Using Cyclic Increments | Similar Problem |Leetcode 2825 |codestorywithMIK
2024-12-01Consistency is 🔑
2024-12-01Adding Spaces to a String | Straight Forward Easy | Leetcode 2109 | codestorywithMIK
2024-11-29Check If N and Its Double Exist | Special Motivation | Leetcode 1346 | codestorywithMIK
2024-11-28Hierholzer's Algorithm | Valid Arrangement of Pairs | Leetcode 2097 | Graph Concepts & Qns - 43
2024-11-28Euler Path | Euler Circuit | PART-3 | Graph Concepts & Qns - 42 | Explanation + Code
2024-11-28November Leetcode Badge, 2024
2024-11-27Minimum Time to Visit a Cell In a Grid | Using Studied Concept | Leetcode 2577 | codestorywithMIK
2024-11-26Minimum Obstacle Removal to Reach Corner I | Using Studied Concept | Leetcode 2290 |codestorywithMIK
2024-11-25Shortest Distance After Road Addition Queries I | Easy Explanation | Leetcode 3243 |codestorywithMIK
2024-11-25Where coding meets storytelling | MIK
2024-11-24Find Champion II | Easy Explanation | Leetcode 2924 | codestorywithMIK
2024-11-23Sliding Puzzle | Detailed for Beginners | Leetcode 773 | codestorywithMIK
2024-11-22Minimum Array Sum | Detailed for Beginners | Contest Problem | Leetcode 3366 | codestorywithMIK