Programmers Zone
Programmers Zone
  • 142
  • 320 675
2053. Kth Distinct String in an Array | Zero to FAANG | Shapnesh | Leetcode
2053. Kth Distinct String in an Array | Zero to FAANG | Leetcode| Shapnesh Tiwari
Problem link :
leetcode.com/problems/kth-distinct-string-in-an-array/description/
Hi, thanks for watching our video about Arrays in C++
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:
th-cam.com/channels/qtYay7YwH8JdZxDqpVEPvg.html
Don’t forget to subscribe!
CHECK OUT OUR OTHER Playlists
GeeksforGeeks playlist:
th-cam.com/play/PLDaU_TBYXoirv-848r81oHLSArcBrjIe7.html
Complete C++ Course playlist:
th-cam.com/play/PLDaU_TBYXoio9L1qRpTrtzK9JJAwFLMSj.html
CodeChef Playlist:
th-cam.com/play/PLDaU_TBYXoip_JFIo0U-Nl2dNA_ZMsd2z.html
HackerRank playlist:
th-cam.com/play/PLDaU_TBYXoirMjgzW59T_XMyT5yRZ7ht_.html
LeetCode problems
th-cam.com/play/PLDaU_TBYXoirsirbg6feNCKk3oPRn6M7w.html
FIND US AT
www.waadanibhao.wordpress.com
GET IN TOUCH
Contact us on hopesalivenow@gmail.com
2053. Kth Distinct String in an Array
A distinct string is a string that is present only once in an array.
Given an array of strings arr, and an integer k, return the kth distinct string present in arr. If there are fewer than k distinct strings, return an empty string "".
Note that the strings are considered in the order in which they appear in the array.
Example 1:
Input: arr = ["d","b","c","b","c","a"], k = 2
Output: "a"
Explanation:
The only distinct strings in arr are "d" and "a".
"d" appears 1st, so it is the 1st distinct string.
"a" appears 2nd, so it is the 2nd distinct string.
Since k == 2, "a" is returned.
Example 2:
Input: arr = ["aaa","aa","a"], k = 1
Output: "aaa"
Explanation:
All strings in arr are distinct, so the 1st string "aaa" is returned.
Example 3:
Input: arr = ["a","b","a"], k = 3
Output: ""
Explanation:
The only distinct string is "b". Since there are fewer than 3 distinct strings, we return an empty string "".
Constraints:
1 = k = arr.length = 1000
1 = arr[i].length = 5
arr[i] consists of lowercase English letters.
#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
มุมมอง: 194

วีดีโอ

2400 Number of Ways to Reach a Position After Exactly k Steps | Zero to FAANG Kunal | Assignment
มุมมอง 6262 ปีที่แล้ว
2400 Number of Ways to Reach a Position After Exactly k Steps | Zero to FAANG Kunal | Assignment | Leetcode | Shapnesh Tiwari Problem link : leetcode.com/problems/number-of-ways-to-reach-a-position-after-exactly-k-steps/ Complete Java DSA Interview Preparation CP Course th-cam.com/play/PL9gnSGHSqcnr_DxHsP7AW9ftq0AtAyYqJ.html Hi, thanks for watching our video about Arrays in Java In this video w...
2399 Check Distances Between Same Letters | Zero to FAANG Kunal | Assignment Solution | Leetcode
มุมมอง 6312 ปีที่แล้ว
2399 Check Distances Between Same Letters | Zero to FAANG Kunal | Assignment Solution | Leetcode | Shapnesh Tiwari Problem link : leetcode.com/contest/weekly-contest-309/problems/check-distances-between-same-letters/ Complete Java DSA Interview Preparation CP Course th-cam.com/play/PL9gnSGHSqcnr_DxHsP7AW9ftq0AtAyYqJ.html Hi, thanks for watching our video about Arrays in Java In this video we’ll...
2375 Construct Smallest Number From DI String | Zero to FAANG | Striver SDE Sheet | Shapnesh | WE2
มุมมอง 4102 ปีที่แล้ว
2375 Construct Smallest Number From DI String | Zero to FAANG | Striver SDE Sheet | Shapnesh | WE2 @Striver Problem link : leetcode.com/problems/construct-smallest-number-from-di-string/ Hi, thanks for watching our video about Strings In this video we’ll walk you through: - Brute Force - Efficient approach - Solution Code TIMESTAMPS Intro Explanation begins IDE solution ABOUT OUR CHANNEL Our ch...
2315 Count Asterisks | Zero to FAANG | Weekly 296 | Striver SDE Sheet | Shapnesh | WE2
มุมมอง 7862 ปีที่แล้ว
2315 Count Asterisks | Zero to FAANG | Weekly 296 | Striver SDE Sheet | Shapnesh | WE2 @Striver Problem link : leetcode.com/problems/count-asterisks/ Hi, thanks for watching our video about Strings 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 co...
2295 Replace Elements in an Array | Zero to FAANG | Weekly 296 | Striver SDE Sheet | Shapnesh | WE2
มุมมอง 7352 ปีที่แล้ว
2293 Min Max Game | Zero to FAANG | Weekly 294 | Leetcode | Striver SDE Sheet | Shapnesh | WE2 @striver_79 Problem link : leetcode.com/problems/replace-elements-in-an-array/ Hi, thanks for watching our video about Arrays 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 a...
2294 Partition Array Such That Maximum Difference Is K | Zero to FAANG | Weekly 296 | Striver | WE2
มุมมอง 6032 ปีที่แล้ว
2293 Min Max Game | Zero to FAANG | Weekly 294 | Leetcode | Striver SDE Sheet | Shapnesh | WE2 Problem link : leetcode.com/problems/partition-array-such-that-maximum-difference-is-k/ Hi, thanks for watching our video about Arrays 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...
2293 Min Max Game | Zero to FAANG | Weekly 296 | Leetcode | Striver SDE Sheet | Shapnesh | WE2
มุมมอง 5722 ปีที่แล้ว
2293 Min Max Game | Zero to FAANG | Weekly 294 | Leetcode | Striver SDE Sheet | Shapnesh | WE2 Problem link : leetcode.com/problems/min-max-game/ Hi, thanks for watching our video about Arrays 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 l...
2280 Minimum Lines to Represent a Line Chart | Zero to FAANG | Weekly 294 | Leetcode | WE2
มุมมอง 2562 ปีที่แล้ว
2280 Minimum Lines to Represent a Line Chart | Zero to FAANG | Weekly 294 | Leetcode | WE2 Problem link : leetcode.com/problems/minimum-lines-to-represent-a-line-chart/ Hi, thanks for watching our video about 2D Arrays 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 abo...
2279 Maximum Bags With Full Capacity of Rocks | Zero to FAANG | Weekly 294 | Leetcode | Striver
มุมมอง 9422 ปีที่แล้ว
2279 Maximum Bags With Full Capacity of Rocks | Zero to FAANG | Weekly 294 | Leetcode | Striver Problem link : leetcode.com/problems/maximum-bags-with-full-capacity-of-rocks/ Hi, thanks for watching our video about Strings 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...
2278 Percentage of Letter in String | Zero to FAANG | Weekly 294 | Leetcode | Striver | WE2
มุมมอง 3652 ปีที่แล้ว
2278 Percentage of Letter in String | Zero to FAANG | Weekly 294 | Leetcode | Striver | WE2 Problem link : leetcode.com/problems/percentage-of-letter-in-string/ Hi, thanks for watching our video about Strings 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 Program...
2270 Number of Ways to Split Array | Zero to FAANG | Solution | Leetcode | Striver | WE2
มุมมอง 6252 ปีที่แล้ว
2270 Number of Ways to Split Array | Zero to FAANG | Solution | Leetcode | Striver | WE2 Problem link : leetcode.com/problems/number-of-ways-to-split-array/ Hi, thanks for watching our video about Arrays 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....
2269 Find the K Beauty of a Number | Zero to FAANG | Solution | Leetcode | Striver | WE2
มุมมอง 9192 ปีที่แล้ว
2269 Find the K Beauty of a Number | Zero to FAANG | Solution | Leetcode | Striver | WE2 Problem link : leetcode.com/problems/find-the-k-beauty-of-a-number/ Hi, thanks for watching our video about Arrays 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....
2265 Count Nodes Equal to Average of Subtree | Zero to FAANG | Solution | Leetcode | Striver | WE2
มุมมอง 2K2 ปีที่แล้ว
2265 Count Nodes Equal to Average of Subtree | Zero to FAANG | Solution | Leetcode | Striver | WE2 Problem link : leetcode.com/problems/count-nodes-equal-to-average-of-subtree/ Hi, thanks for watching our video about Trees 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...
2264 Largest 3 Same Digit Number in String | Zero to FAANG | Solution | Leetcode | Striver | WE2
มุมมอง 9212 ปีที่แล้ว
2264 Largest 3 Same Digit Number in String | Zero to FAANG | Solution | Leetcode | Striver | WE2 Problem link : leetcode.com/problems/largest-3-same-digit-number-in-string/ Hi, thanks for watching our video about Arrays 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 ab...
2256 Minimum Average Difference | Zero to FAANG | Assignment Solution | Leetcode | Striver | WE2
มุมมอง 1.1K2 ปีที่แล้ว
2256 Minimum Average Difference | Zero to FAANG | Assignment Solution | Leetcode | Striver | WE2
2255 Count Prefixes of a Given String | Zero to FAANG | Assignment Solution | Leetcode | Striver
มุมมอง 8562 ปีที่แล้ว
2255 Count Prefixes of a Given String | Zero to FAANG | Assignment Solution | Leetcode | Striver
2248. Intersection of Multiple Arrays | Zero to FAANG | Assignment Solution | Leetcode | Striver
มุมมอง 8262 ปีที่แล้ว
2248. Intersection of Multiple Arrays | Zero to FAANG | Assignment Solution | Leetcode | Striver
682 Baseball Game | Zero to FAANG | Assignment Solution | Leetcode | Striver | WE2 | Shapnesh
มุมมอง 4102 ปีที่แล้ว
682 Baseball Game | Zero to FAANG | Assignment Solution | Leetcode | Striver | WE2 | Shapnesh
215 Kth Largest Element in an Array | 703. Kth Largest Element in a Stream | Priority Queue | WE2
มุมมอง 1832 ปีที่แล้ว
215 Kth Largest Element in an Array | 703. Kth Largest Element in a Stream | Priority Queue | WE2
454 4Sum II | Zero to FAANG | Assignment Solution | Leetcode | Shapnesh | Programmers Zone
มุมมอง 2572 ปีที่แล้ว
454 4Sum II | Zero to FAANG | Assignment Solution | Leetcode | Shapnesh | Programmers Zone
Good Weather(GOODWEAT) | CodeChef Practice(Beginner) | CodeChef | Complete Solutions
มุมมอง 5642 ปีที่แล้ว
Good Weather(GOODWEAT) | CodeChef Practice(Beginner) | CodeChef | Complete Solutions
1346 Check If N and Its Double Exist | Zero to FAANG | Assignment Solution | Leetcode | Shapnesh
มุมมอง 3K2 ปีที่แล้ว
1346 Check If N and Its Double Exist | Zero to FAANG | Assignment Solution | Leetcode | Shapnesh
1089. Duplicate Zeros | Zero to FAANG Kunal | Assignment Solution | Leetcode | Shapnesh
มุมมอง 3.7K2 ปีที่แล้ว
1089. Duplicate Zeros | Zero to FAANG Kunal | Assignment Solution | Leetcode | Shapnesh
Equal Or Not Equal | CodeForces | Educational Codeforces Round 119 (Rated for Div. 2) | Shapnesh
มุมมอง 3372 ปีที่แล้ว
Equal Or Not Equal | CodeForces | Educational Codeforces Round 119 (Rated for Div. 2) | Shapnesh
Equal Coins (EQUALCOIN) | Codechef Long November | November Challenge 2021 Division 3
มุมมอง 4.1K2 ปีที่แล้ว
Equal Coins (EQUALCOIN) | Codechef Long November | November Challenge 2021 Division 3
Which Fuel is Cheaper (CHEAPFUEL) | Codechef Long November | November Challenge 2021 Division 3
มุมมอง 2.6K2 ปีที่แล้ว
Which Fuel is Cheaper (CHEAPFUEL) | Codechef Long November | November Challenge 2021 Division 3
DSA | Binary Search | lecture 02 | Best explanation of Binary Search in arrays
มุมมอง 2863 ปีที่แล้ว
DSA | Binary Search | lecture 02 | Best explanation of Binary Search in arrays
DSA | linear Search | lecture 01 | Best explanation of linear Search in arrays
มุมมอง 1363 ปีที่แล้ว
DSA | linear Search | lecture 01 | Best explanation of linear Search in arrays
2011 Final Value of Variable After Performing Operations | Zero to FAANG Kunal | Leetcode | Shapnesh
มุมมอง 4.6K3 ปีที่แล้ว
2011 Final Value of Variable After Performing Operations | Zero to FAANG Kunal | Leetcode | Shapnesh

ความคิดเห็น

  • @creativeeducator42
    @creativeeducator42 2 วันที่ผ่านมา

    Thank you for explanation ❤️

  • @aoodi-volt
    @aoodi-volt หลายเดือนก่อน

    bro

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

    Bhaaiaah mujhe to solutions dekhne pad rahe hai. Intuition build up.hi nahi ho raha 😢

  • @royabhishek-t1u
    @royabhishek-t1u หลายเดือนก่อน

    super bro

  • @DhruvGupta-f3n
    @DhruvGupta-f3n หลายเดือนก่อน

    nice explanation

  • @siddhesh119369
    @siddhesh119369 2 หลายเดือนก่อน

    Good explanation 👏

  • @user-rq2ku9jp8q
    @user-rq2ku9jp8q 2 หลายเดือนก่อน

    is maximum subarray question not solved

  • @user-rq2ku9jp8q
    @user-rq2ku9jp8q 2 หลายเดือนก่อน

    i cant understand these optimal approaches , what should i do?

  • @Geetadevi-xn3bs
    @Geetadevi-xn3bs 2 หลายเดือนก่อน

    For brute force aaproch first year is 1993 for this Maxyear = i+1950 How i mean i = 43 but i is not negtive please explain

  • @sainayan
    @sainayan 2 หลายเดือนก่อน

    Not a good solution but a unique one.

  • @gintokiblade1448
    @gintokiblade1448 2 หลายเดือนก่อน

    Clear explanation

  • @yuvrajsingh-r8i
    @yuvrajsingh-r8i 2 หลายเดือนก่อน

    Restart Sir

  • @Pshorts786
    @Pshorts786 3 หลายเดือนก่อน

    but why this problem is on easy level i dont know

  • @ashking569
    @ashking569 3 หลายเดือนก่อน

    kunal and you are doing an excellent job ! Thank You <3

  • @rohitrana5701
    @rohitrana5701 3 หลายเดือนก่อน

    Leet code ki easy solutions bhi medium level ke hai

  • @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..

  • @GK-lm2rw
    @GK-lm2rw 3 หลายเดือนก่อน

    Nice Explanation sir..

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

    Great explnation man!

  • @meme-ku1vs
    @meme-ku1vs 4 หลายเดือนก่อน

    thanks,btw nice explanation ✔✔❣❣

  • @SubhajitDas-mt7sn
    @SubhajitDas-mt7sn 5 หลายเดือนก่อน

    class Solution { public: int finalValueAfterOperations(vector<string>& operations) { int x = 0; int n = operations.size(); for (int i = 0;i <n;i++){ if(operations[i] == "++X" || operations[i] == "X++"){ x++; } else{ x--; } } return x; } };

  • @sourabhsharma2511
    @sourabhsharma2511 5 หลายเดือนก่อน

    good work bro !!!!!!!!!!!

  • @rituraj_79
    @rituraj_79 5 หลายเดือนก่อน

    pen paper leh le bhai usmai humlogo ko better dikhaga

  • @shinobiworld860
    @shinobiworld860 5 หลายเดือนก่อน

    Nice thanks

  • @abhikumarr7306
    @abhikumarr7306 5 หลายเดือนก่อน

    Compilation Error ./Solution.cpp: In function 'void iter(std::vector<int>::iterator, std::vector<int>::iterator)': ./Solution.cpp:19:22: error: 'it' was not declared in this scope for(it1;it1!=it2;it++)

  • @ganeshjaggineni4097
    @ganeshjaggineni4097 5 หลายเดือนก่อน

    NICE SUPER EXCELLENT MOTIVATED

  • @rishabhsinghal138
    @rishabhsinghal138 6 หลายเดือนก่อน

    use LinkedList to improve the time complexity as insertion is O(1) in LinkedList and O(n) in array list

  • @dibbodas4116
    @dibbodas4116 6 หลายเดือนก่อน

    why the time complexity is not o(n*m)

  • @SouravCheck
    @SouravCheck 6 หลายเดือนก่อน

    why my code is not running var twoSum = function(nums, target) { for(let i=0;i<nums.length;i++) { for(j=i+1;j<nums.length;j++) { if((nums[i]+nums[j])==target) { console.log("the indices where target matched is="); console.log("["+i+","+j+"]"); } } } };]

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

      run the first loop till nums.length - 1

  • @clevercoderjoy
    @clevercoderjoy 7 หลายเดือนก่อน

    iska logic kaise banaya bhai? mai kaise aise sochna seekh pau? ye to mai soch hi nhi skta tha kbhi to

  • @hari7110
    @hari7110 8 หลายเดือนก่อน

    bro help why its not passing all test case? it tried to solve using binary search import java.util.Arrays; class Solution { public boolean checkIfExist(int[] arr) { Arrays.sort(arr); for (int i = 0; i < arr.length; i++) { if (binarySearch(arr, arr[i], i)) { return true; } } return false; } private boolean binarySearch(int[] arr, int target, int i) { int start = 0; int end = arr.length - 1; while (start <=end) { int mid = start + (end - start) / 2; if ((mid != i)&&(arr[mid]/2 == target )) { return true; } else if (arr[mid] < target && mid!=0) { start = mid + 1; } else { end = mid - 1; } } return false; } }

  • @kallabhargavi-d7j
    @kallabhargavi-d7j 8 หลายเดือนก่อน

    nums=[0,2,1,5,3,4] result1=[] for i in range(len(nums)): result=nums[nums[i]] result1.append(result) print(result1)

  • @PrakashKumar-pf5st
    @PrakashKumar-pf5st 8 หลายเดือนก่อน

    thank u brother ,

  • @srijansrivastav9637
    @srijansrivastav9637 8 หลายเดือนก่อน

    Thank you bro

  • @hemantyadav1047
    @hemantyadav1047 8 หลายเดือนก่อน

    IN while loop, it should be greater than or equal to 1

  • @gitansh194
    @gitansh194 8 หลายเดือนก่อน

    nice explanation

  • @harshSharmaaji
    @harshSharmaaji 8 หลายเดือนก่อน

    Thankyou man!

  • @AkshatKumar-lp7qk
    @AkshatKumar-lp7qk 9 หลายเดือนก่อน

    Since it is given that 0<=nums[i]<=n, there is need to do mod with n.

  • @Dekh_rha_hai_vinod.
    @Dekh_rha_hai_vinod. 9 หลายเดือนก่อน

    Bro 1920 ???

  • @bharatmehta30
    @bharatmehta30 10 หลายเดือนก่อน

    Loved this explanation and concept. Thank you

  • @Kumkum-n9v
    @Kumkum-n9v 10 หลายเดือนก่อน

    how did you come up with this approach? I mean the thought process

  • @harshityadav6817
    @harshityadav6817 10 หลายเดือนก่อน

    2:47 bich wala flip nhi krenge agar 3*3 ki matrix hui but agar 4*4 ki matrix hui toh kyuki agr 4*4 Me pura flip krenge toh bech me pura flip hoga na. Im bit confused here

  • @Jaydoshi77
    @Jaydoshi77 10 หลายเดือนก่อน

    spiral matrix 3 wala solve kro plez............

  • @Jaydoshi77
    @Jaydoshi77 10 หลายเดือนก่อน

    bhai spiral matrix 3 ispe video banao plez

  • @kalpitgudigar
    @kalpitgudigar 11 หลายเดือนก่อน

    tysm for the explanation

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

    thanks bhaiya

  • @PadmanabanN-ue4xd
    @PadmanabanN-ue4xd ปีที่แล้ว

    Thank you brother

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

    Excellent explanation!

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

    improve handwriting please

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

    Thanks brother

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

    In question it is written that we have to return the first occurrence of the max year which will be not the case with brute force solution