Approach 1: Idiomatic

class Solution:
    def reversePrefix(self, word: str, ch: str) -> str:
        i = word.find(ch)
        
        return word[i::-1] + word[i+1:] if i != -1 else word

Complexity

Time:
Space:

Approach 2: Stack

#TODO

Approach 3: Two-pointer

#TODO

Other Languages

Go

func reversePrefix(word string, ch byte) string {
    runes := []rune(word)
    i := slices.Index(runes, rune(ch))
 
    if i == -1 {
        return word
    }
 
    slices.Reverse(runes[:i+1])
    return string(runes)
}