my solution beats 100% class Solution { public int countPrefixSuffixPairs(String[] words) { int cnt = 0; for (int i = 0; i < words.length; i++) { for (int j = 0; j < words.length; j++) { if (i != j && i < j) { if (isPrefixAndSuffix(words[i], words[j])) { cnt++; } } } } return cnt; } public boolean isPrefixAndSuffix(String A, String B) { return (B.startsWith(A) && B.endsWith(A)); } }
like target is 150. Please do like if you have understood the explanation as well as the code 😄😄
what if constrains are huge ??
@Mannu_20 tries can be used.
Happy birthday Sir🎉!!!
Thankyou
Happy Birthday Bhaiya 🥰
Thankyou ♥️
Happy Birthday Sirrr😁😁😁
@@anushkaap thankyou anushka 🙏🥳💫
@@shashwat_tiwari_st welcome sir
Happy birthday brother 🎉🎂
Thankyou
happy birthday sir i daily watch your video😃😅😅
Thank you! Happy to have you here 🙏
Happy Birthday Sir
Thankyou
Happy birthday sir😃
Thankyou
Okay bhaiya
Happy Birthday bro
Thankyou ♥️
happiest birthday bhaiya
Thankyou ♥️
happiest birthday sirrrr
@@namanlalwani8079 thankyou ♥️
@@namanlalwani8079 thankyou ♥️
@@shashwat_tiwari_st sir your solutions are helping us a lot.
class Solution {
public int countPrefixSuffixPairs(String[] words) {
int ans =0;
for(int i=0;i
Bhaiya wiggle sort 2 par bhi video bana dijiye please bhaiya please leetcode 324 please bhaiya
bhaiya please KPM algo kara do
Okay 👍
my solution beats 100%
class Solution {
public int countPrefixSuffixPairs(String[] words) {
int cnt = 0;
for (int i = 0; i < words.length; i++) {
for (int j = 0; j < words.length; j++) {
if (i != j && i < j) {
if (isPrefixAndSuffix(words[i], words[j])) {
cnt++;
}
}
}
}
return cnt;
}
public boolean isPrefixAndSuffix(String A, String B) {
return (B.startsWith(A) && B.endsWith(A));
}
}
@@Prabhatsinghrajput-qj3jo j=i+1 better hoga bcoz mention hai question me j>I krke.
@@shashwat_tiwari_st ok thanks !