filmov
tv
Find if Array Can Be Sorted | Detailed Approaches | Dry Runs | Leetcode 3011 | codestorywithMIK
![preview_player](https://i.ytimg.com/vi/TYOnpelfejY/maxresdefault.jpg)
Показать описание
This is the 120th Video of our Playlist "Array 1D/2D : Popular Interview Problems" by codestorywithMIK
In this video we will try to solve a medium-easy Array based Problem which checks your fundamentals i.e. Bubble Sort : Find if Array Can Be Sorted | Detailed Approaches | Dry Runs | Leetcode 3011 | codestorywithMIK
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 : Find if Array Can Be Sorted | Detailed Approaches | Dry Runs | Leetcode 3011 | codestorywithMIK
Company Tags : will update
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
Summary :
Bubble Sort with Swapping Condition Approach:
This method involves attempting to sort the array using a modified bubble sort algorithm.
During the sorting, adjacent elements are swapped only if they have the same number of set bits (1s in their binary representation).
If a swap is not allowed due to differing set bit counts and sorting becomes impossible, the function returns false.
The array is checked for complete sorting after each pass, and if no swaps are needed in a pass, the array is considered sorted and the function returns true.
Segmented Sorting by Set Bits Approach:
This approach involves dividing the array into segments based on the number of set bits in each element.
Each segment is treated independently, and elements within a segment are compared to find the segment's maximum and minimum.
A new segment starts when an element has a different number of set bits than the previous ones.
The algorithm checks if the minimum of the current segment is greater than or equal to the maximum of the previous segment to ensure correct ordering between segments.
If any segment fails this condition, the function returns false, indicating that sorting is not possible under the given constraints.
The function returns true if all segments are arranged properly by the end.
✨ Timelines✨
00:00 - Introduction
#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
In this video we will try to solve a medium-easy Array based Problem which checks your fundamentals i.e. Bubble Sort : Find if Array Can Be Sorted | Detailed Approaches | Dry Runs | Leetcode 3011 | codestorywithMIK
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 : Find if Array Can Be Sorted | Detailed Approaches | Dry Runs | Leetcode 3011 | codestorywithMIK
Company Tags : will update
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
Summary :
Bubble Sort with Swapping Condition Approach:
This method involves attempting to sort the array using a modified bubble sort algorithm.
During the sorting, adjacent elements are swapped only if they have the same number of set bits (1s in their binary representation).
If a swap is not allowed due to differing set bit counts and sorting becomes impossible, the function returns false.
The array is checked for complete sorting after each pass, and if no swaps are needed in a pass, the array is considered sorted and the function returns true.
Segmented Sorting by Set Bits Approach:
This approach involves dividing the array into segments based on the number of set bits in each element.
Each segment is treated independently, and elements within a segment are compared to find the segment's maximum and minimum.
A new segment starts when an element has a different number of set bits than the previous ones.
The algorithm checks if the minimum of the current segment is greater than or equal to the maximum of the previous segment to ensure correct ordering between segments.
If any segment fails this condition, the function returns false, indicating that sorting is not possible under the given constraints.
The function returns true if all segments are arranged properly by the end.
✨ Timelines✨
00:00 - Introduction
#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
Комментарии