Skip to content

Commit

Permalink
Time: 60 ms (92.52%), Space: 56.4 MB (10.57%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
joseantoniochacon committed Jun 1, 2024
1 parent a754e52 commit a407e65
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions 0383-ransom-note/0383-ransom-note.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* @param {string} ransomNote
* @param {string} magazine
* @return {boolean}
*/
var canConstruct = function(ransomNote, magazine) {
while(magazine.search(ransomNote[0]) != -1 && ransomNote.length > 0){
magazine = magazine.replace(ransomNote[0],'');
ransomNote = ransomNote.slice(1);
}
if(ransomNote == ''){
return true;
}
return false;
};

0 comments on commit a407e65

Please sign in to comment.