Skip to content

Commit 81ebc2b

Browse files
solves reverse a string in python
1 parent 3f6327c commit 81ebc2b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
| 326 | [Power of Three](https://leetcode.com/problems/power-of-three) | Easy | [![Java](https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png)](https://github.com/anishLearnsToCode/leetcode-algorithms/blob/master/src/PowerOfThree.java) [![Python](https://img.icons8.com/color/35/000000/python.png)](python/power_of_three.py) |
9595
| 339 | 🔒 [Nested List Weight Sum](https://leetcode.com/problems/nested-list-weight-sum) | Easy | |
9696
| 342 | [Power of Four](https://leetcode.com/problems/power-of-four) | Easy | [![Java](https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png)](https://github.com/anishLearnsToCode/leetcode-algorithms/blob/master/src/PowerOf4.java) [![Python](https://img.icons8.com/color/35/000000/python.png)](python/power_of_four.py) |
97-
| 344 | [Reverse A String](https://leetcode.com/problems/reverse-string) | Easy | [![Java](https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png)](https://github.com/anishLearnsToCode/leetcode-algorithms/blob/master/src/ReverseString.java) |
97+
| 344 | [Reverse A String](https://leetcode.com/problems/reverse-string) | Easy | [![Java](https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png)](https://github.com/anishLearnsToCode/leetcode-algorithms/blob/master/src/ReverseString.java) [![Python](https://img.icons8.com/color/35/000000/python.png)](python/reverse_a_string.py) |
9898
| 345 | [Reverse Vowels of A String](https://leetcode.com/problems/reverse-vowels-of-a-string) | Easy | [![Java](https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png)](https://github.com/anishLearnsToCode/leetcode-algorithms/blob/master/src/ReverseVowelsOfString.java) |
9999
| 346 | [Moving Average From Data Stream](https://leetcode.com/problems/moving-average-from-data-stream) | Easy | |
100100
| 349 | [Intersection of 2 Arrays](https://leetcode.com/problems/intersection-of-two-arrays) | Easy | [![Java](https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png)](https://github.com/anishLearnsToCode/leetcode-algorithms/blob/master/src/IntersectionOfTwoArrays.java) |

python/reverse_a_string.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from typing import List
2+
3+
4+
class Solution:
5+
def reverseString(self, s: List[str]) -> None:
6+
for index in range(len(s) // 2):
7+
s[index], s[len(s) - index - 1] = s[len(s) - index - 1], s[index]

0 commit comments

Comments
 (0)