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

preview_player
Показать описание
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

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

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
Рекомендации по теме
Комментарии
Автор

Thank you very much
Got selected in cognizant

om
Автор

I was literally waiting for this day. Sir i Got internship in Samsung R&D Delhi All Because of your guidance and support .. You r motivational videos helped a lot to start my day with good mind set.. Thank you So Much Sir.. And i thank God for having you as my mentor

beenasatyendrapal
Автор

Hi bhaiya
Just wanted to tell you that i got placed today in deutsche bank
All thanks to ur constant videos and guidance♥️

avinashshukla
Автор

thank you sir so much .... apke motivating words sunke bahut accha lgta hai

shashwatshukla
Автор

heyy, @codestorywithMIK
please make videos on DBMS & Computer Networks.
kyunki aapki system design ki playlist boht help karii🙌

abhinavanand
Автор

Man, your dedication level is unmatched . Hats off 🔥

aws_handles
Автор

Phew 2 hard ke bas aaj Sunday ko easy aa gaya

vedanthbaliga
Автор

Enjoy the Road Trip MIK.
Thank you for the motivation.
I was able to solve using brute force and hashset.
Will solve using bsearch as well.

gui-codes
Автор

0:27 - I promise I will wark even harder starting from 1st January, 2025. It's a Promise.
I will crack Product Based Company

gui-codes
Автор

hello bhaya, firstly love the way you teach trust me you are changing a lot of students life by providing your valuable content, as you know contest are very important for upskilling can you after every gfg/leetcode contest do a live stream where you solve the problems, this is going to help a lot of students

immortalzz
Автор

Hello bhaiya ..
I can't able to solve contest problem ..
Also i take so much time to solve any problem .. i got demotivated many times. I don't know what to do 🙂

harshitpathak
Автор

sir i request you to start covering codechef weekly contest their is lack of quality content over there and i assure you will get lot new audience

Sudeepgangwar
Автор

bhaiya also make video editorials on medium and hard questions on leetcode weekly contests

sandeepmukherjee
Автор

2023 mera bhut learning bhara rha lekin 2024 me meri galti ye thi jp mene aaj realise kri ki mene sirf socha tha ye kruga wo kruga but wo kiya nahiii poori energy k sath to me 2025 ka wait nahi krunga abhi b 1 mahina hai to abhi se chaalu ho jauga

gauravparasar
Автор

sir could be please upload videos for weekly contest as well its a request🥺

pplcantuseuwhenuruseless
Автор

can you cover this problem ??
Reverse Nodes In K Group

pranavsharma
Автор

day 2 of requesting more videos in segment tree playlist 🥲

YashMalav-khov
Автор

Hello bhaiya, aapse ek special request thi, don't know agar aap ye message dekho ki nhi but i hope that you will see this message, .. i just want you to make a video on ford fulkerson algorithm, please bhaiya .. ❤

HarmanSingh-nwix