Тёмный

#day3 

RCTECHLIFE
Подписаться 2,4 тыс.
Просмотров 172
50% 1

Leetcode question: leetcode.com/p...
#leetcode #75hardchallenge #day3 #faang #maang #google
Reverse Words in a String III :
Approach:
1. Using two pointers, 'start' and 'end', each time 'end' reaches a space, we reverse the words before.
2. To reverse, we convert the String 's' to a char array, then write a method to reverse the char in the array.
1. Convert s into char array.
2. take a loop
3. When 'end' reaches a space character ' ', reverse the words from 'start' to 'end' - 1 index in 'chars'.
4. reset the start for the next word.
Example
s = "Let's take LeetCode contest"
char ch= 'l','e','t'.......

Опубликовано:

 

3 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 1   
@rinkuchoudhary226
@rinkuchoudhary226 Год назад
public class Solution { public string ReverseWords(string s) { int start=0; int end; char[] ch=s.ToCharArray(); for(end=0;end
Далее
SQL Querying for Beginners Tutorial
2:45:17
Просмотров 260 тыс.
У КОТЯТ ОТКРЫЛИСЬ ГЛАЗКИ#cat
00:26
Лучше одной, чем с такими
00:54
Просмотров 942 тыс.
Reverse Sentence By Words - Logic Building Practice
6:49
Being Competent With Coding Is More Fun
11:13
Просмотров 87 тыс.
Mastering the Art of Competitive Programming
1:36:12
2851. String Transformation (Leetcode Hard)
1:42:58
Просмотров 1,8 тыс.
Extra Characters in a String - Leetcode 2707 - Python
21:11
У КОТЯТ ОТКРЫЛИСЬ ГЛАЗКИ#cat
00:26