Merge Sorted Array - Leetcode 88 - Arrays & Strings (Python)

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ก.พ. 2025
  • Master Data Structures & Algorithms for FREE at AlgoMap.io/
    Code solutions in Python, Java, C++ and JS for this can be found at my GitHub repo here: github.com/gah...
    Complete DSA Pathway Zero to Hero: • Data Structures & Algo...
    Please check my playlists for free DSA problem solutions:
    • Fundamental DSA Theory
    • Array & String Questions
    • 2 Pointers Questions
    • Sliding Window Questions
    • Binary Search Questions
    • Stack Questions
    • Linked List Questions
    • Tree Questions
    • Heap Questions
    • Recursive Backtracking...
    • Graph Questions
    • Dynamic Programming (D...
    My Data Science & ML TH-cam Playlist: • Greg's Path to Become ...
    Learn Python and Data Science FASTER at mlnow.ai :)
    Support the content: / @greghogg
    Follow me on Instagram: / greghogg5
    Connect with me on LinkedIn: / greghogg
    Follow me on TikTok: / greghogg5
    Coursera Plus: imp.i384100.ne...
    My Favorite Courses:
    Data Structures & Algorithms:
    UCalifornia San Diego DSA: imp.i384100.ne...
    Stanford Algorithms: imp.i384100.ne...
    Python Data Structures: imp.i384100.ne...
    Meta Coding Interview Prep: imp.i384100.ne...
    Python:
    UMichigan Python for Everybody: imp.i384100.ne...
    Python Mastery from MLNOW.ai: mlnow.ai/cours...
    Google IT Automation w/ Python: imp.i384100.ne...
    Web Dev / Full Stack:
    Meta Front-End Developer: imp.i384100.ne...
    IBM Full Stack Developer: imp.i384100.ne...
    Meta Back-End Developer: imp.i384100.ne...
    John Hopkins HTML, CSS & JS: imp.i384100.ne...
    IBM DevOps: imp.i384100.ne...
    Cloud Development:
    AWS Fundamentals: imp.i384100.ne...
    GCP Cloud Engineer: imp.i384100.ne...
    Microsoft Azure Fundamentals: imp.i384100.ne...
    Game Development:
    Michigan State Unity Development: imp.i384100.ne...
    UColorado C++ for Unreal Engine: www.coursera.o...
    SQL & Data Science:
    SQL by MLNOW.ai: mlnow.ai/cours...
    Python for Data Science by MLNOW.ai: mlnow.ai/cours...
    Google Data Analytics: imp.i384100.ne...
    IBM Data Science: imp.i384100.ne...
    IBM Data Engineer: imp.i384100.ne...
    Machine Learning & AI:
    ML Mastery at MLNOW.ai: mlnow.ai/cours...
    ML w/ Andrew Ng: www.coursera.o...
    Deep Learning w/ Andrew Ng: imp.i384100.ne...

ความคิดเห็น • 17

  • @GregHogg
    @GregHogg  5 หลายเดือนก่อน

    Master Data Structures & Algorithms for FREE at AlgoMap.io/

  • @tradeiteasyy
    @tradeiteasyy 6 หลายเดือนก่อน +3

    Please explain brute, better and optimised approaches so that it would be beneficial more in solving problem..thanks for your teaching,its awesome 😊

    • @surajbkunte7672
      @surajbkunte7672 4 หลายเดือนก่อน +1

      void merge(vector& nums1, int m, vector& nums2, int n) {
      for(int i = m; i

  • @W16-1
    @W16-1 หลายเดือนก่อน

    Thanks, it really helped : )

  • @rdubb77
    @rdubb77 6 หลายเดือนก่อน +2

    This should be a medium. 3 pointers, reverse iteration, sorting…For christ sake “length of last word” is an easy 😂

    • @theognis1002
      @theognis1002 5 หลายเดือนก่อน

      exactly. good luck solving in an interview question (if uve never seen it before)

    • @Everafterbreak_
      @Everafterbreak_ 5 หลายเดือนก่อน +2

      i've solved hard problems easier than this one for sure

    • @veotic2728
      @veotic2728 หลายเดือนก่อน +1

      @@Everafterbreak_ leetcode difficulty is not accurate MOST of the time. there's TONs of easy questions that are harder than mediums

  • @s.gveeronstart4794
    @s.gveeronstart4794 6 หลายเดือนก่อน +2

    Sir can u upload free python tutorial 0 to hero with DSA

    • @GregHogg
      @GregHogg  6 หลายเดือนก่อน +1

      algomap.io has all of this

  • @HarunFarah
    @HarunFarah 2 หลายเดือนก่อน

    I know its not in the spirit of the problem but wouldn't this work
    nums1[m:] = nums2
    nums1.sort()

  • @wanderlust1814
    @wanderlust1814 3 หลายเดือนก่อน

    class Solution(object):
    def merge(self, nums1, m, nums2, n):
    for i in range(n):
    nums1[m+i]=nums2[i]
    nums1.sort()
    can you please explain this 🥺

  • @whitetiger1810
    @whitetiger1810 หลายเดือนก่อน +1

    What about:
    def merge(self, nums1, m, nums2, n):
    nums1[m:] = nums2
    nums1.sort()

    • @axpg1297
      @axpg1297 หลายเดือนก่อน +2

      obviously works but you aren't passing an interview with that.

    • @whitetiger1810
      @whitetiger1810 หลายเดือนก่อน +3

      @axpg1297 as if anyone gives interviews anymore

    • @krishshroff5719
      @krishshroff5719 9 วันที่ผ่านมา

      @@axpg1297 why not