Final Array State After K Multiplication Operations I | Detailed | Leetcode 3264 | codestorywithMIK

Поділитися
Вставка
  • Опубліковано 16 гру 2024

КОМЕНТАРІ • 41

  • @mohdareeb3541
    @mohdareeb3541 18 годин тому +1

    Brute Force Approach :
    class Solution {
    private:
    void min(vector &nums , int multiplier) {
    int mini = nums[0];
    int j = 0;
    for(int i = 1; i < nums.size(); i++) {
    if(nums[i] < mini) {
    mini = nums[i];
    j = i;
    }
    }
    nums[j] = mini*multiplier;
    }
    public:
    vector getFinalState(vector& nums, int k, int multiplier) {
    while(k--) {
    min(nums,multiplier);
    }
    return nums;
    }
    };

  • @09_anshpatel95
    @09_anshpatel95 День тому +13

    I manage to complete this one by myself using the most optimal approach thanks to you for all the confidence. If possible can you also make a video about the Hard version of this question i think that will help lot of people thanks.

  • @DebopriyoBasu
    @DebopriyoBasu День тому +7

    I have completed this by myself using min heap. Still watching your video for learning from your thought process.

  • @joydeep-halder
    @joydeep-halder День тому +3

    Solved the problem easily using priority queue. But still you don't fail to provide new concepts. Hats off Bhaiya 🔥 Didn't know about this make_heap

  • @aws_handles
    @aws_handles День тому +9

    This Legend woke up at I don’t know when, posted a video at 5 AM and now posted another video of today’s POTD 😭😭😭
    Mai bhi mehnat karunga yaar itni. I want this level of dedication 😭😭

  • @tarupathak
    @tarupathak 23 години тому +1

    You github repo is pure gold, thankyouuu and thankyouuuuuuuuuuuuuuuuuuuuu

    • @mohdareeb3541
      @mohdareeb3541 18 годин тому

      can you share the link please ?

  • @sayanbiswas2116
    @sayanbiswas2116 День тому +1

    Brute Approach
    class Solution {
    public:
    pair small(vector& nums)
    {
    int n=nums.size();
    int smoll=nums[0];
    int pos=0;
    for(int i=1;i nums[i])
    {
    smoll=nums[i];
    pos=i;
    }
    }
    return {smoll,pos};
    }
    vector getFinalState(vector& nums, int k, int multiplier) {
    while(k--)
    {
    pair pos=small(nums);
    nums[pos.second]=pos.first * multiplier;
    }
    return nums;
    }
    };

  • @Shattered2715
    @Shattered2715 День тому +3

    same sir aaj ka motivation mere liye perfect he kyoki aaaj he mene dekhi kuch logo ki profile or jealous feel huva ki unhone itni jalde sab kar liya hn or abhe mne tu start he kiya hn or second year mn bhe hun bahot late hun esa feel ho rha tha 😅

  • @abhijeetkundu3597
    @abhijeetkundu3597 День тому +4

    I did it myself thanks it was easy today

  • @thekindspill
    @thekindspill День тому +1

    Pehle Heap, Graph, sliding window jaise topics se dar lagta tha. But not now. Thanks to you MIK ❤

  • @Akashkumar_12
    @Akashkumar_12 День тому +2

    Kabhi kabhi lagta hai mai cpp ka pura syntax bhi nhi janta mujhe aaj ye pta chla bhaiya 😢

  • @sauravchandra10
    @sauravchandra10 День тому +1

    Python approach using heapify (Beats 100% Py submissions):
    class Solution:
    def getFinalState(self, nums: List[int], k: int, multiplier: int) -> List[int]:
    pq = [(nums[ind], ind) for ind in range(len(nums))]
    heapq.heapify(pq)
    for _ in range(k):
    el, ind = heappop(pq)
    nums[ind] = el*multiplier
    heappush(pq, (nums[ind], ind))
    return nums

  • @peaches7627
    @peaches7627 День тому +3

    he is not scared of consistency , consistency is scared of him

  • @vanshmodi14
    @vanshmodi14 21 годину тому

    Bhaiya logic ban gaya tha sirf syntax error aagayi...tysm mik bhaiya❤

  • @randomrandom-n5s
    @randomrandom-n5s 11 годин тому +1

    but when elements are rearranged in push_heap( ), it will be entered at the last index of the array right ? and then accordingly it will get sort but this should take O(logn) right ? the internal working of the heapify tree remains same here, so the over all sloution stil remains n*logn, isn't it ? because what would be the possibility that the new number formed will always be less then all the elements ( in case if you are wondering that push_heap() just adds the new element in the starting of the array resulting in same heap that heapify will give-- which is i think not the case )

  • @dayashankarlakhotia4943
    @dayashankarlakhotia4943 День тому +2

    First 🎉❤

  • @gui-codes
    @gui-codes День тому

    Thank you so much for resuming DP Concepts. Waiting for next video .
    Done today's POTD easily.

  • @Zoro_tao
    @Zoro_tao День тому +6

    Learnt about heapify today...
    That's why i always watch your vedio even though i managed to solve this problem on my own
    ❤❤❤

  • @RishabhChatterjee-fg2gz
    @RishabhChatterjee-fg2gz День тому +2

    Iska part 2 kyese hoga bhaiya, kya observation hai wo video banao bhaiya
    Leetcode 3266

  • @psychologyfact2320
    @psychologyfact2320 День тому +1

    Can you please solve the 3266 the second version of this problem

  • @RonaldBaker-z7k
    @RonaldBaker-z7k 19 годин тому

    Thanks for the analysis! A bit off-topic, but I wanted to ask: My OKX wallet holds some USDT, and I have the seed phrase. (alarm fetch churn bridge exercise tape speak race clerk couch crater letter). How can I transfer them to Binance?

  • @100solarmass
    @100solarmass День тому +1

    Please do something for LEETCODE contest also 🙏🙏🙏

  • @rahulbansal5082
    @rahulbansal5082 День тому +2

    plz make video on the its 2nd part for large inputs

  • @RaviMishra-wx6gx
    @RaviMishra-wx6gx День тому +1

    Please also solve in java

  • @debangshudey5515
    @debangshudey5515 День тому

    Please make yesterday's leetcode contest question 3 video. It was very hard

  • @vishwashsoni610
    @vishwashsoni610 День тому +1

    sir this how i solved this question :
    class Solution {
    public:
    typedef pair P;
    vector getFinalState(vector& nums, int k, int multiplier) {
    int n = nums.size();
    priority_queue pq;
    for(int i=0;i

    • @anonymoushackerar7507
      @anonymoushackerar7507 День тому +1

      same solution

    • @tushar404
      @tushar404 23 години тому +1

      Same
      But while(--k){
      for(i to n)// to find min value of array each time
      this is better as its k*n
      }

  • @AyushGupta29164
    @AyushGupta29164 23 години тому

    bhai dsa course launch kar do

  • @Denzel_in_engineering
    @Denzel_in_engineering День тому

    Bhaiya video ki slides ki pdf bhi upload Kar diya kariya

    • @codestorywithMIK
      @codestorywithMIK  День тому +1

      Added the link in the video description above ❤️🙏

  • @KeshavKumar-jh2en
    @KeshavKumar-jh2en День тому +1

    please solution of yesterday contest of leetcode. hard and medium question please @codestorywithmik