2053. Kth Distinct String in an Array | string | Leetcode Daily Challenge | DSA | Hindi

Поделиться
HTML-код
  • Опубликовано: 27 окт 2024

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

  • @shashwat_tiwari_st
    @shashwat_tiwari_st  2 месяца назад +1

    Like target for this video is 100. Please do like if you have understood the explanation.😊😊

  • @kevalyagupta359
    @kevalyagupta359 2 месяца назад

    Thank you

  • @explorescience6510
    @explorescience6510 2 месяца назад

    concept clear and great explanation. Keep it up❤

  • @pranatis2314
    @pranatis2314 2 месяца назад

    how do you think of edge cases while problem solving, would love some video or content on this

  • @AbhishekKumar-hu2pz
    @AbhishekKumar-hu2pz 2 месяца назад

    Bhaiya when will graph series completed and dp series start?

  • @vibhutiagrawal5105
    @vibhutiagrawal5105 2 месяца назад

    Hey, qq - which approach out of the last two do you think is more optimal? The one using Hashmap or the one using Hashset?

    • @shashwat_tiwari_st
      @shashwat_tiwari_st  2 месяца назад

      both have same tc, you can explain anyone to the interviewer.

  • @ankitagrawal4477
    @ankitagrawal4477 2 месяца назад

    Will sorting work?

  • @Nikhil_3239
    @Nikhil_3239 2 месяца назад

    grt explain

  • @PiyushSharma-we8yd
    @PiyushSharma-we8yd 2 месяца назад

    "why single set fails" Jb bhi ata hu aap kuch naya sikha dete ho bhaiya. Thankyou 😍😍

  • @RohitKumar-dz8dh
    @RohitKumar-dz8dh 2 месяца назад

    Thanks 😊

  • @GirjeshSharma-zv3xo
    @GirjeshSharma-zv3xo 2 месяца назад

    Day5 of request for do series

  • @priyanshgarg1292
    @priyanshgarg1292 2 месяца назад

    class Solution {
    public String kthDistinct(String[] arr, int k) {
    HashMap map=new HashMap();
    for(int i=0;i

  • @max1237
    @max1237 2 месяца назад

    Thank you sir
    New subscriber 🩷

  • @nishantrathore5031
    @nishantrathore5031 2 месяца назад

    public static String kthDistinct(String[] arr, int k) {
    Map mp = new LinkedHashMap();
    for(var str : arr){
    mp.put(str,mp.getOrDefault(str,0)+1);
    }
    int tmp = k;
    for(String freq : mp.keySet()){
    if(mp.get(freq) > 1) continue;
    if(mp.get(freq)==1){
    tmp--;
    }
    if(tmp==0) return freq;
    }
    return "";
    } this is my brute force solution is this efficient ?