- 142
- 320 675
Programmers Zone
India
เข้าร่วมเมื่อ 8 พ.ค. 2020
The Programmers Zone
It's your one stop destination where you can learn from zero to advanced.
Learn various languages from scratch till advanced.
Remember journey of miles begins with a single step.
Love the concepts ❤️
Comment your needs
Geeks for Geeks, hacker rank , hacker earth, SPOJ
Videos every day
It's your one stop destination where you can learn from zero to advanced.
Learn various languages from scratch till advanced.
Remember journey of miles begins with a single step.
Love the concepts ❤️
Comment your needs
Geeks for Geeks, hacker rank , hacker earth, SPOJ
Videos every day
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
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
Thank you for explanation ❤️
bro
Bhaaiaah mujhe to solutions dekhne pad rahe hai. Intuition build up.hi nahi ho raha 😢
super bro
nice explanation
Good explanation 👏
is maximum subarray question not solved
i cant understand these optimal approaches , what should i do?
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
Not a good solution but a unique one.
Clear explanation
Restart Sir
but why this problem is on easy level i dont know
kunal and you are doing an excellent job ! Thank You <3
Leet code ki easy solutions bhi medium level ke hai
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..
Nice Explanation sir..
Great explnation man!
thanks,btw nice explanation ✔✔❣❣
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; } };
good work bro !!!!!!!!!!!
pen paper leh le bhai usmai humlogo ko better dikhaga
Nice thanks
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++)
NICE SUPER EXCELLENT MOTIVATED
use LinkedList to improve the time complexity as insertion is O(1) in LinkedList and O(n) in array list
why the time complexity is not o(n*m)
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+"]"); } } } };]
run the first loop till nums.length - 1
iska logic kaise banaya bhai? mai kaise aise sochna seekh pau? ye to mai soch hi nhi skta tha kbhi to
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; } }
nums=[0,2,1,5,3,4] result1=[] for i in range(len(nums)): result=nums[nums[i]] result1.append(result) print(result1)
thank u brother ,
Thank you bro
IN while loop, it should be greater than or equal to 1
nice explanation
Thankyou man!
Since it is given that 0<=nums[i]<=n, there is need to do mod with n.
Bro 1920 ???
Loved this explanation and concept. Thank you
how did you come up with this approach? I mean the thought process
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
spiral matrix 3 wala solve kro plez............
bhai spiral matrix 3 ispe video banao plez
tysm for the explanation
thanks bhaiya
Thank you brother
Excellent explanation!
improve handwriting please
Thanks brother
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