#32: Collection.Counter( ) | | Hacker Rank Python Solution | English Explanation

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024
  • All the videos of python hackerrank series are available on channel
    #collectioncounterhackerranksolution #collectioncounterhackerranksolution #python #hackerranksolution #hackerrankpythonsolution
    #Python #Hackerrank

Комментарии • 9

  • @immoshu
    @immoshu 2 года назад

    money = 0
    x=int(input())
    shoe_size = list (map(int,input().split(" ")))
    number_of_customer = int(input())
    for i in range(number_of_customer):
    size,prize = map(int,input().split())
    if size in shoe_size:
    money = money+prize
    shoe_size.remove(size)
    print(money)

  • @shubhambhosale8467
    @shubhambhosale8467 3 года назад

    runtime error

    • @NSTuts
      @NSTuts  3 года назад

      code :
      n=int(input())
      from collections import Counter
      stock=list(map(int,input().split(' ')))
      dict=Counter(stock)
      p=0
      k=int(input())
      for i in range(k):
      size,price=map(int,input().split())
      if dict[size]:
      dict[size]-=1
      p=p+price
      print(p)
      Thanks,
      Keep Coding !

    • @shubhambhosale8467
      @shubhambhosale8467 3 года назад

      @@NSTuts no bro its still showing error

    • @NSTuts
      @NSTuts  3 года назад

      @@shubhambhosale8467 Bro there might be writing mistake in the code . As you can se in the video my code works fine. You send me code here i will check it otherwise mail me the screenshot of the error
      Regards NS Tuts,
      keep coding.

    • @shubhambhosale8467
      @shubhambhosale8467 3 года назад

      @@NSTuts mail id?

    • @NSTuts
      @NSTuts  3 года назад

      @@shubhambhosale8467 nihalsarmalkar1@gmail.com