How to get 'Constant Space' Algorithms in Coding Interviews | Reverse String - Leetcode 344

preview_player
Показать описание
leetcode, coding interview question, data structures, data structures and algorithms, faang
Рекомендации по теме
Комментарии
Автор

Master Data Structures & Algorithms For FREE at AlgoMap.io!

GregHogg
Автор

kind ironic that they pretend to care about memory.. and then gives us 3MB javascript to track us on the web.

AndrewTSq
Автор

C# be like: strings are immutable.

C# also be like: if you sell your soul to Marshal, you can reverse a string in place

AvenDonn
Автор

The really SENIOR developer answer should be" If you need that.. you should not be using python. ".

tiagodagostini
Автор

Love your material. In grad school for data science at STU. Have been able to solve 0 of these problems.

scottmiller
Автор

.reverse() be like: "why am i even here?"

lolikpof
Автор

When everything is done inplace, it is always good. 👍

piyusharora
Автор

s[:]=s[::-1] would be a more intuitive way to explain what you’re tryna say (compared to return s[::-1]

abhimanyus
Автор

Would not it still require extra memory, as new objects are created every time you do "="? I mean string is just an array of pointers, you keep it at original place, but pointers are now point to a new objects?

Crazmuss
Автор

This seems like the perfect way to ensure that you’re paying for rarer (and therefore more expensive) talent than you will ever be able to take advantage of.

storminmormin
Автор

For bonus points, make the swap without using temporary swap variable, aka bitwise in place swap.

MrRedTux
Автор

If only coding interviews actually gave these types of problems :( My 1st ever coding interview for a entry level job was "Create an algorithm to solve any given Board position in Sudoku"... I've never played sudoku in my life. (I failed)

ViktorTheRook
Автор

This only works in Python though, right? I can't use two pointers simultaneously in C or C++, or am I wrong?

sebastianbenner
Автор

Hey there, sorry to ask but, how is that O(1)? Wouldn't the length of the list (n) dictate how long it will take, making it O(n) ?

rodaguj
Автор

Hey can you make dsa series instead of yt shorts ?
Because python dsa resources are not available most are in cpp or java.
Btw Your teaching style is good.

ashishmishra
Автор

These kinds of questions in interviews do nothing but boost the interviewers ego when they get to sit there watching someone squirm trying to solve a problem they will almost never have to solve in reality. If they do they would just Google it or ask an LLM work smarter not harder.

murtagh
Автор

Hi ...what is this website he's using(am new to the coding stuff)

shooterking
Автор

"Two pointers", those are not pointers, but simple cursors.

galactic_dust
Автор

I don't know much about C# or python, And I don't understand why there is something called immutable strings, but this string reversing is very easy in C

colinmaharaj
Автор

I don’t know if I’ve ever explicitly used pointers in python

storminmormin