Interview Questions: How to reverse a string in C/C++ using two pointers

preview_player
Показать описание
In this video I will explain how to use two pointers to reverse characters of a string in-place using O(N) execution time. This is often asked during interviews and learning how to do this efficiently is going to help you hone your coding & interviewing skills.

Thank you for your support!
Рекомендации по теме
Комментарии
Автор

I'm sweating after this one. Very fantastic video that encourages planning before writing your code!

bern
Автор

Thank you, I was able to use this as a way to check my Lab assignment. Also, good to know the real world value of my studies as often times it seems like endless practice with little to no knowledge of use in the field.

chibibree
Автор

Great video, helped me out a lot in understanding how to reverse the character string.

NordiskStudio
Автор

Why does pEnd have to be pStart + Length -1; isnt pstart at an index of 0 so it doesnt make a difference to add pstart? I think i might be misunderstanding something.

samuelcarrasco
Автор

Thank you so much!!! The string.h helped me solve the problem....I knew the size of the array s[128] was 128 and I was setting pointerEnd= pointerStart+128 -1, since I thought string length would equal the size of the array but I'm guessing its literally the length of the string not the array. It works

_valles
Автор

great tutorial and great explanation. Understand it perfectly now. Thanks

numberjuan
Автор

Why do you need to -1 in : pStart + strlen(pString) - 1 ?

VinhDTx
Автор

What is this pString, where do you define it or initialize?

Rumen
Автор

Thanks for the video!

Would there be a way to set this up to reverse something that a user inputs?
For example: a user entering "hello" and having it be reversed and outputted as "olleh"

UberShadow
Автор

hi, can u help me with this homework?Given a string as input, write an algorithm, that will display the mirrored string of the input string

danielrusu
Автор

we can make a loop and let i point to the end of string and while we didn't reach 0, we i = i-1; this is simpler.

dunnowut
Автор

Isn't this a bubble sort? I thought bubble sorts were inefficient.

arnmazing
Автор

can i have the palindrome and recursion explanation

ashishmaurya
Автор

But I see three pointers in the solution... :)

volchonokilliR