diff --git a/Match 02/submissions/yashvardhan.singhsomvanshi.min.js b/Match 02/submissions/yashvardhan.singhsomvanshi.min.js new file mode 100644 index 0000000..c40f5b0 --- /dev/null +++ b/Match 02/submissions/yashvardhan.singhsomvanshi.min.js @@ -0,0 +1,48 @@ +function uniq(str,n){ + var index = 0; + for (var i = 0; i < n; i++){ var j; + for (j = 0; j < i; j++){if (str[i] == str[j]) + {break;} + } + if (j == i) + { str[index++] = str[i];} + } + return str.join("").slice(str, index);} + var str = ` when i find myself in times of trouble + mother mary comes to me + speaking words of wisdom, let it be + and in my hour of darkness + she is standing right in front of me + speaking words of wisdom, let it be + let it be, let it be + let it be, let it be + whisper words of wisdom, let it be + and when the broken-hearted people + living in the world agree + there will be an answer, let it be + for though they may be parted + there is still a chance that they will see + there will be an answer, let it be + let it be, let it be + let it be, let it be + yeah, there will be an answer, let it be + let it be, let it be + let it be, let it be + whisper words of wisdom, let it be + let it be, let it be + ah, let it be, yeah, let it be + whisper words of wisdom, let it be + and when the night is cloudy + there is still a light that shines on me + shine on until tomorrow, let it be + i wake up to the sound of music, + mother mary comes to me + speaking words of wisdom, let it be + let it be, let it be + let it be, yeah, let it be + oh, there will be an answer, let it be + let it be, let it be + let it be, yeah, let it be + whisper words of wisdom, let it be`.split(" "); + var n = str.length; + document.write(uniq(str, n)); diff --git a/Match 03/submissions/yashvardhan.singhsomvanshi.min.js b/Match 03/submissions/yashvardhan.singhsomvanshi.min.js new file mode 100644 index 0000000..ef7c828 --- /dev/null +++ b/Match 03/submissions/yashvardhan.singhsomvanshi.min.js @@ -0,0 +1,8 @@ +const sort_string=(word)=>(word.split("").sort((i,j)=>i.charCodeAt()-j.charCodeAt())).join(); +function check(word) + { + for(const letter of word) + {if(letter.toUpperCase().charCodeAt()<65 || letter.toUpperCase().charCodeAt()>90) + { return false;}} +return true;} +const solution=(a, b)=> (check(a) && check(b))?sort_string(a)==sort_string(b):false;