Total Cost to Hire K Workers II Greedy II Min Heap II Priority Queue II 2 Pointers II Leetcode 2462

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ธ.ค. 2024

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

  • @ARYANMITTAL
    @ARYANMITTAL  ปีที่แล้ว +4

    Checkout DSA-169 Series: th-cam.com/video/5BuKVS-Vnws/w-d-xo.html
    Problem Link: leetcode.com/problems/total-cost-to-hire-k-workers/description/
    Code & Notes: drive.google.com/file/d/14mJ9Kvr-5EkAX2thm1A0IgrQDqK5YG_q/view?usp=sharing

  • @mukulkhanna26
    @mukulkhanna26 ปีที่แล้ว

    bohot gajab bhai u r my real guru

  • @karanjitrandhawa1515
    @karanjitrandhawa1515 ปีที่แล้ว

    Best Explaination

  • @anexocelisia9377
    @anexocelisia9377 ปีที่แล้ว +4

    🔥

  • @yashmodi3388
    @yashmodi3388 ปีที่แล้ว +1

    Can any one help me where i am doing wrong?
    Here is code
    class Solution:
    def totalCost(self, costs: List[int], k: int, candidates: int) -> int:
    cr = 0
    for i in range(k):
    if 2*candidates < len(costs):
    min1 = min(costs[:candidates])
    min2 = min(costs[-candidates:])
    print(min1,min2)
    mi = min(min1,min2)
    cr+=mi
    costs.remove(mi)
    else:
    mi= min(costs)
    cr+=mi
    costs.remove(mi)
    print(mi,costs)
    return cr
    Test Case Passed(108/165)
    Failed one
    costs =
    [50,80,34,9,86,20,67,94,65,82,40,79,74,92,84,37,19,16,85,20,79,25,89,55,67,84,3,79,38,16,44,2,54,58]
    k =
    7
    candidates =
    12
    My answer 86
    Expected 95

    • @lashdev5935
      @lashdev5935 4 หลายเดือนก่อน

      exactly same for me

  • @Yogesh-ei1lg
    @Yogesh-ei1lg ปีที่แล้ว +1

    brother, please explain all langauges codes, will be very helpful including java. Takes hardly 1-2 minute more

    • @Yogesh-ei1lg
      @Yogesh-ei1lg ปีที่แล้ว

      Don't care for those who cry that the videos are very long. Most of them copies your code without even watching the video doesn't matter its small or big length.

    • @bharathkumar5870
      @bharathkumar5870 ปีที่แล้ว

      if you are dsa skills are dependent on language..then dsa is not for you bro...learn the language which you aree using first

    • @Yogesh-ei1lg
      @Yogesh-ei1lg ปีที่แล้ว +1

      @@bharathkumar5870 Looks loke you smoke weed on monday night.. First you are saying that dsa is not for me due to languange dependency & then you are saying learn the language. And, also tell me the weed you are using, seems fantastic!

    • @bharathkumar5870
      @bharathkumar5870 ปีที่แล้ว +3

      @@Yogesh-ei1lg it u are still asking the mentor to teach the logic in the language you know..then your are unfit for learning

  • @shubhamraj25
    @shubhamraj25 ปีที่แล้ว +6

    Bhai hil kam aur bol jyada