Isomorphic Strings Leetcode problem number 205 Solution in JAVA JAVA interview programming playlist: • Interview Programming ... Linkedin: / amrita-bala-a2b79460 #java #interviewquestions #leetcode
Пікірлер: 30
@GurjeetSingh-zr7vj8 ай бұрын
It is an partial algorithm , The code didn't check condition weather the used char is again used or not, if it is used we do not say the strings are isomorphic. For Resolving - we have to use hashset which contains only those char who used only once. code - class Solution { public boolean isIsomorphic(String s, String t) { HashMap map = new HashMap(); HashSet check = new HashSet(); for(int i=0;i
@nitishkumar-mj9tp3 ай бұрын
@GurjeetSingh-zr7vj ,Your code is small ,but it takes 8-10 minutes for me to understand. Thanks
@saratdas88868 күн бұрын
the indentation and the brackets opening and closing are not taken care of , and also this code is partially complete , this doesn't pass all test cases
@nitishkumar-mj9tp3 ай бұрын
To the point video, very nice for entry-level experience people(1-2 yr), they don't want everything from basics which takes more time.
@androiddeveloperlpu30110 ай бұрын
For those code is not running write the condition of checking length of both the strings is not equal then return false
@amitsgada Жыл бұрын
Please zoom out the page little bit cannot see the above code lines when explaining or writing code. Keep the zoom in such a way that whole code logic is visible everytime
@TechnosageLearning Жыл бұрын
Sure..Will take care next time
@MsArn3 Жыл бұрын
Please soom out, we cant barly see an intire line of code
@amitchaurasia5922 ай бұрын
Can you check the below one abcs pqrb
@WHAGDEVARAKONDAVAISHNAVI Жыл бұрын
thank you mam.....for your explanation...................
@tufguygaming6 ай бұрын
This is the Code beats 100% users in C++ class Solution { public: bool isIsomorphic(string s, string t) { if(s.size()!=t.size()){ return false; } int hash[256]={0}; // mapping of characters from string s int isMapped[256]={0}; // ensures that mapping goes to which of the word in t for(int i=0;i
@adityamishra18683 ай бұрын
explanation is good but they way of writting code is worst, u are placing cbraces before adding if or else
@roopkumar2803 Жыл бұрын
very well explained ma'am
@shindeprem2282 ай бұрын
class Solution { public boolean isIsomorphic(String s, String t) { if(s.length()!=t.length()) return false; HashMap hm = new HashMap(); for(int i=0 ; i
@rishikanth45192 ай бұрын
🙏
@kathakalisaha9735Ай бұрын
thanks
@shindeprem2286 күн бұрын
@@rishikanth4519 👍
@shindeprem2286 күн бұрын
@@kathakalisaha9735 👍
@hirahasan Жыл бұрын
check your solution with "asdvd" and "kkk"
@TechnosageLearning Жыл бұрын
It is returning false since these strings are not isomorphic strings
@suhasdevang933211 ай бұрын
@@TechnosageLearninginstead coding in local ide do code in leetcode so that your code not running successfully for all the testcases
@aapkikhushi4689 Жыл бұрын
Code ka last mai image dal do atleast
@TechnosageLearning Жыл бұрын
Git ka url dia hai..Usme sare codes hai..You can try it out..
The Above solution seems to be not passing for all the tests.... Please refer below solution , It works s = "foo" t="bar" 1) sToT['f']= b and tToS['b'] = f 2) sToT['o']= a and tToS['a'] = o 3) sToT['o']= a and tChar = r public bool IsIsomorphic(string s, string t) { char[] sTOT = new char[256]; char[] tTOS = new char[256]; for (int i = 0;i< s.Length;i++) { char sChar = s[i]; char tChar = t[i]; if (sTOT[sChar] ==0 && tTOS[tChar] == 0) { sTOT[sChar] = tChar; tTOS[tChar] = sChar; }else if(sTOT[sChar] != tChar) { return false; } } return true; }
@mhirroaceroyportillo875 Жыл бұрын
I’m afraid this solution will fail given s = abdc t = abab
@TechnosageLearning Жыл бұрын
It would return false...since these two strings are not isomorphic .."No two characters may map to same character" But in this case..a-->a and d-->a so it should return false only..
@suhasdevang933211 ай бұрын
@@TechnosageLearning but your code not running for all the testcase