🔧 Leetcode - 28. Find the Index of the First Occurrence in a String
Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to
Javascript Code
var strStr = function (haystack, needle) {
if (needle.length === 0) return 0;
if (needle.length > haystack.length) return -1;
let n = needle.length;
let h = haystack.length;
for (let i = 0; i <= h - n; i++) {
let match = true;
for (let j = 0; j < n; j++) {
if (haystack[i + j] !== needle[j]) {
match = false;
break;
}
}
if (match) return i;
}
return -1;
};
🔧 Balance the occurrence of unique characters
📈 27.45 Punkte
🔧 Programmierung
🔧 Grok 3: AI Thông Minh Nhất Thế Giới
📈 25.48 Punkte
🔧 Programmierung
🔧 Có thể bạn chưa biết (Phần 1)
📈 25.48 Punkte
🔧 Programmierung
🔧 LeetCode Day8 String Part.2
📈 21.36 Punkte
🔧 Programmierung
🔧 LeetCode Day8 String
📈 21.36 Punkte
🔧 Programmierung
🔧 Leetcode - 151. Reverse Words in a String
📈 21.36 Punkte
🔧 Programmierung
🔧 Leetcode — 3110. Score of a String
📈 21.36 Punkte
🔧 Programmierung
🔧 Leetcode 678 :- Valid Parenthesis String
📈 21.36 Punkte
🔧 Programmierung
🔧 Leetcode - 443. String Compression
📈 21.36 Punkte
🔧 Programmierung