Sort the Jumbled Numbers | 2 Approaches | Leetcode 2191 | codestorywithMIK

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



Duration: 27:05
6,473 views
282


Whatsapp Community Link : https://www.whatsapp.com/channel/0029...
This is the 40th Video of our Playlist "Strings : Popular Interview Problems" by codestorywithMIK

In this video we will try to solve a very good String Problem : Sort the Jumbled Numbers | 2 Approaches | Leetcode 2191 | 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 : Sort the Jumbled Numbers | 2 Approaches | Leetcode 2191 | codestorywithMIK
Company Tags : Will update soon
My solutions on Github(C++ & JAVA) - https://github.com/MAZHARMIK/Intervie...
Leetcode Link : https://leetcode.com/problems/sort-th...


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/Intervie...
Instagram :   / codestorywithmik  
Facebook :   / 100090524295846  
Twitter :   / cswithmik  
Subscribe to my channel :    / @codestorywithmik  

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

Summary :
Approach 1: Converting to String

Time Complexity: O(n * d + n * log n)
Converting each number to a string and mapping digits takes O(n * d) time.
Sorting the vector of pairs takes O(n * log n) time.
Space Complexity: O(n + d)
Requires space for the vector of pairs (O(n)) and temporary strings (O(d)).
Explanation: This approach converts each number to its string representation, maps each digit using the provided mapping array, and converts the mapped string back to an integer. It then sorts the mapped numbers while maintaining the original indices, and constructs the result array based on the sorted order.

Approach 2: Without Converting to String

Time Complexity: O(n * d + n * log n)
Mapping digits directly and forming the mapped number takes O(n * d) time.
Sorting the vector of pairs takes O(n * log n) time.
Space Complexity: O(n)
Requires space for the vector of pairs (O(n)).
Explanation: This approach directly maps each digit of the number without converting the number to a string. It processes each digit, forms the mapped number, and stores it along with the original index. The mapped numbers are then sorted, and the result array is constructed based on the sorted order.


✨ Timelines✨
00:00 - Introduction
3:31 - Approach-1
10:20 - Coding Approach-1
16:53 - Approach-2
23:41 - Coding Approach-2


#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 #newyear2024




Other Videos By codestorywithMIK


2024-08-05Integer to English Words | Story To Code | Leetcode 273 | codestorywithMIK
2024-08-03Happy Friendship Day ❤️
2024-08-03Range Sum of Sorted Subarray Sums | Learning Something New | Leetcode 1508 | codestorywithMIK
2024-08-01Make Two Arrays Equal by Reversing Subarrays | Easy | Leetcode 1460 | codestorywithMIK
2024-07-31Minimum Swaps to Group All 1's Together II | 2 Ways | Dry Runs | Leetcode 2134 | codestorywithMIK
2024-07-29Filling Bookcase Shelves | Recursion Memoization | Why not Greedy | Leetcode 1105 | codestorywithMIK
2024-07-28Minimum Deletions to Make String Balanced | Multiple Approaches | Leetcode 1653 | codestorywithMIK
2024-07-27Count Number of Teams | Simple thought process | Intuition | Leetcode 1395
2024-07-26Second Minimum Time to Reach Destination | 2 Approaches | FULL DRY RUN | Leetcode 2045
2024-07-24Find the City With the Smallest Number of Neighbors at a Threshold Distance | 3 Ways | Leetcode 1334
2024-07-22Sort the Jumbled Numbers | 2 Approaches | Leetcode 2191 | codestorywithMIK
2024-07-20Minimum Operations to Make Array Equal to Target | Minimum Number of Increments|Leetcode 3229 & 1526
2024-07-19Build a Matrix With Conditions | BFS | DFS | Detailed Explanation | Leetcode 2392 | codestorywithMIK
2024-07-19Palindrome Partitioning | Using Blue Print | DP On Strings | Leetcode 131 | DP Concepts & Qns-27
2024-07-18Find Valid Matrix Given Row and Column Sums | Simple Approach | Leetcode 1605 | codestorywithMIK
2024-07-18Number of Good Leaf Nodes Pairs | Simple DFS | Dry Run | Leetcode 1530 | codestorywithMIK
2024-07-17Lucky Numbers in a Matrix | 2 Approaches | Dry Run | Leetcode 1380 | codestorywithMIK
2024-07-16Number of Good Leaf Nodes Pairs | Using Graph And BFS | Dry Run | Leetcode 1530 | codestorywithMIK
2024-07-14Step-By-Step Directions From a Binary Tree Node to Another | 2 Approaches | Leetcode 2096
2024-07-13Create Binary Tree From Descriptions | Simplest Approach | Leetcode 2196 | codestorywithMIK
2024-07-12Range Sum Query - Mutable | Leetcode 307 | Segment Tree Concepts & Qns | Video 8 | codestorywithMIK