---
title: "Discussion on \"LeetCode: Find the Index of the First Occurrence in a String\" | Hashnode"
description: "Discussion on \"LeetCode: Find the Index of the First Occurrence in a String\". Problem:\nhttps://leetcode.com/problems/find-the-index-of-the-first-occurrence-in-a-string/description/\nCode:\nclass Solution:\n    def strStr(self, haystack: str, needle: str) -> int:\n        return haystack.find(needle)\n\nKey Points:\nCore Idea\nWe need ..."
url: "https://hashnode.com/posts/leetcode-find-the-index-of-the-first-occurrence-in-a-string/692b16509f7b06db4acf8d72"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [LeetCode: Find the Index of the First Occurrence in a String](https://is-power-of-two.hashnode.dev/leetcode-find-the-index-of-the-first-occurrence-in-a-string?utm_source=hashnode&utm_medium=feed)

Problem: https://leetcode.com/problems/find-the-index-of-the-first-occurrence-in-a-string/description/ Code: class Solution: def strStr(self, haystack: str, needle: str) -> int: return haystack.find(needle) Key Points: Core Idea We need ...

Nov 29, 2025 · 1 min read · is-power-of-two.hashnode.dev  
Read the article

-   [#leetcode](https://hashnode.com/tag/leetcode)

## Written by

[Shahwar Alam Naqvi](https://hashnode.com/@shahwar01)

@shahwar01

  
[View profile](https://hashnode.com/@shahwar01)

Coder

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
