Reverse Prefix of Word -Leetcode 2000 || Detailed Solution || EASY || AMAZON GOOGLE INTERVIEW
Вставка
- Опубліковано 29 кві 2024
- Problem Link: 🔗
leetcode.com/problems/reverse...
Problem Description:
Given a 0-indexed string word and a character ch, reverse the segment of word that starts at index 0 and ends at the index of the first occurrence of ch (inclusive). If the character ch does not exist in word, do nothing.
For example, if word = "abcdefd" and ch = "d", then you should reverse the segment that starts at 0 and ends at 3 (inclusive). The resulting string will be "dcbaefd".
Return the resulting string.
Check out the Solution:✅👇
leetcode.com/problems/reverse...
Time Complexity: O(n)
Space Complexity: O(1)
#interview #amazoninterview #googleinterview #strings #leetcode #coding #observation #dailychallenge #leetcodedailychallenge
Nice one bro 🎉
thnx
Keep it up bro 🔥☑
thnx