Reverse String | LeetCode 344 | C++, Java, Python

preview_player
Показать описание

**** Best Books For Data Structures & Algorithms for Interviews:**********
*****************************************************************************

June LeetCoding Challenge | Problem 4 | Reverse String | 4 June,
Facebook Coding Interview question,
google coding interview question,
leetcode,
Reverse String,
Reverse String c++,
Reverse String Java,
Reverse String python,
Reverse String solution,
344. Reverse String,

#Facebook #CodingInterview #LeetCode #JuneLeetCodingChallenge #Google #Amazon #ReverseString
Рекомендации по теме
Комментарии
Автор

Solution in C++ using STL std::swap:

void reverseString(vector<char>& s) {
for (std::size_t i = 0; i < s.size() / 2; ++i) {
std::swap(s[i], s[s.size() - 1 - i]);
}
}
Note that only half of the string is traversed in the loop.

peymanbr
Автор

thanks for these videos man. been following these series for a month and I only knew java in the beginning. learned c++ and python just from watching these

johnpatrick
Автор

bro simple code (just one step) using the builtin std c++
class Solution {
public:
void reverseString(vector<char>& s) {
reverse(s.begin(), s.end());
}
};

Akash-lhqi
Автор

Sir it would be a great help if you make separate playlist for easy, medium and different

shaamidrees
Автор

Nice explanation, Can you please create video for Dynamic Programming tricks and Graph theory algos

FenixFahad
Автор

Wt is the difference if we run loop till len /2

surakarthikeya
Автор

why these logics don't click in our mind, we just look for solution
any suggestion?

sincereshikha
Автор

Wait for some reason I thought it has to be recursive algorithm.

mdlwlmdddwd