1773 Count Items Matching a Rule | Zero to FAANG Kunal | Assignment Solution | Leetcode

Поділитися
Вставка
  • Опубліковано 19 жов 2024
  • 1773 Count Items Matching a Rule | Zero to FAANG Kunal | Assignment Solution | Leetcode
    Problem link :
    leetcode.com/p...
    Course link:
    github.com/kun...
    Complete Java + DSA + Interview Preparation + CP Course
    • Java + DSA + Interview...
    Hi, thanks for watching our video about 2D Arrays in Java
    In this video we’ll walk you through:
    Brute Force
    Efficient approach
    Solution Code
    TIMESTAMPS
    Intro
    Explanation begins
    IDE solution
    ABOUT OUR CHANNEL
    Our channel is all about Programming. We cover lots of cool stuff such as solution to problems, concept explanation and tricks to master CP
    Check out our channel here:
    / @programmerszone
    Don’t forget to subscribe!
    CHECK OUT OUR OTHER Playlists
    GeeksforGeeks playlist:
    • GeeksforGeeks problems
    Complete C++ Course playlist:
    • Complete C++ playlist
    CodeChef Playlist:
    • CodeChef Problems
    HackerRank playlist:
    • HackeRank problems
    LeetCode problems
    • Leetcode problems Solu...
    FIND US AT
    www.waadanibha...
    GET IN TOUCH
    Contact us on hopesalivenow@gmail.com
    1773. Count Items Matching a Rule
    Easy
    You are given an array items, where each items[i] = [typei, colori, namei] describes the type, color, and name of the ith item. You are also given a rule represented by two strings, ruleKey and ruleValue.
    The ith item is said to match the rule if one of the following is true:
    ruleKey == "type" and ruleValue == typei.
    ruleKey == "color" and ruleValue == colori.
    ruleKey == "name" and ruleValue == namei.
    Return the number of items that match the given rule.
    Example 1:
    Input: items = [["phone","blue","pixel"],["computer","silver","lenovo"],["phone","gold","iphone"]], ruleKey = "color", ruleValue = "silver"
    Output: 1
    Explanation: There is only one item matching the given rule, which is ["computer","silver","lenovo"].
    Example 2:
    Input: items = [["phone","blue","pixel"],["computer","silver","phone"],["phone","gold","iphone"]], ruleKey = "type", ruleValue = "phone"
    Output: 2
    Explanation: There are only two items matching the given rule, which are ["phone","blue","pixel"] and ["phone","gold","iphone"]. Note that the item ["computer","silver","phone"] does not match.
    Constraints:
    1 = items.length = 104
    1 = typei.length, colori.length, namei.length, ruleValue.length = 10
    ruleKey is equal to either "type", "color", or "name".
    All strings consist only of lowercase letters.
    Accepted
    #codechef #coding #python #hackerrank #programming #java #computerscience #coder #code #competitiveprogramming #machinelearning #pythonprogramming #algorithms #cpp #javascript #hackerearth #webdeveloper #geeksforgeeks #codinglife #leetcode #c #codeforces #engineering #codingmemes #programmer #hacker #programmingmemes #topcoder #webdevelopment #bhfyp #DSAwithKunal

КОМЕНТАРІ • 30

  • @gamabuntagamabunta353
    @gamabuntagamabunta353 2 роки тому +3

    class Solution {
    public int countMatches(List items, String ruleKey, String ruleValue) {
    int ruleIndex = 0;
    switch(ruleKey){
    case "color": ruleIndex = 1;
    break;
    case "name": ruleIndex = 2;
    break;
    default:
    break;
    }
    int count =0;
    for(List item: items){
    if(item.get(ruleIndex).equals(ruleValue)){
    count++;
    }
    }
    return count;

    }
    }

  • @rohitrana5701
    @rohitrana5701 3 місяці тому

    It seema to be little difficult for beginners who have directly come for solving questions after understanding the concept of array.😢😢😢😢😢. logic of solving this Question didn't strike in my mind..

  • @mukulsehgal2190
    @mukulsehgal2190 2 роки тому +1

    bro aapse first time me ye saari problems solve hogyi thi leetcode ki because i am finding it hard from last 2 problem i was not able to get near about the logic any tips suggestions or personal expirience please

    • @ProgrammersZone
      @ProgrammersZone  2 роки тому +4

      Bhai agar one go me nhi hoti to kuchh time baad solutions dekh liya karo
      And usse revise kiya karo hone lagega dheere dheere

  • @arabindrajak4951
    @arabindrajak4951 2 роки тому

    thora sa samgh kar khudh se solve kar liya
    thankyou

  • @satyamgupta6030
    @satyamgupta6030 Рік тому

    thanks brother for the explaination please keep making such more videos.

  • @PosVibesplz
    @PosVibesplz 2 роки тому

    bhai plz aise hi zyada se zyada question cover kardo most of the times question solve karne se zyada bada problem usse samajhna hota hai app question bahut accha se samjha te ho plz bhai cover more questions also like this

  • @sanugupta2965
    @sanugupta2965 2 роки тому +1

    your problem solving technique is very unique and it also help us to understand all the concept behind any questions. thank you soo much.

  • @shrirambalaji2915
    @shrirambalaji2915 2 роки тому

    Thank you bro

  • @simardeepkaur8275
    @simardeepkaur8275 3 роки тому

    Thanks and make more videos

  • @chikuu6770
    @chikuu6770 Рік тому

    Bro I watch your videos. I have a question in mind, are you a student or employed.

  • @aniketmadame4270
    @aniketmadame4270 3 роки тому

    great;)

  • @aparnatripathi8859
    @aparnatripathi8859 2 роки тому

    how can I get items in list without add items

    • @ProgrammersZone
      @ProgrammersZone  2 роки тому

      I'm unable to get your question

    • @aparnatripathi8859
      @aparnatripathi8859 2 роки тому

      @@ProgrammersZone bina items ko add kiye bina hum ushko use kese kr pa rhe hai

    • @harshgautam3586
      @harshgautam3586 2 роки тому

      @@aparnatripathi8859 method ke input me 2d list he vo items he. to item as a input mil rahi he.

  • @Caped_Crusader7
    @Caped_Crusader7 Рік тому

    Please explain in English! Most of us don't know Hindi!

  • @akshayasalaskar9102
    @akshayasalaskar9102 Рік тому

    have you, yourself also learnt from Kunal Kushwaha or you have studied all this from your own experience????

    • @ProgrammersZone
      @ProgrammersZone  Рік тому

      Mostly studied from my experience and learnt from @takeuforward

  • @akhileshkumbar4864
    @akhileshkumbar4864 Рік тому

    improve handwriting please

  • @shashanksharma7747
    @shashanksharma7747 3 роки тому

    can you give your linkedin username??