Move Pieces to Obtain a String | Leetcode 2337

preview_player
Показать описание
This video explains Move Pieces to Obtain a String leetcode problem using the most optimal two pointer approach.
----------------------------------------------------------------------------------------------------------------------------------------------------------------
🟣 JOIN our 𝐋𝐈𝐕𝐄 𝐢𝐧𝐭𝐞𝐫𝐯𝐢𝐞𝐰 𝐭𝐫𝐚𝐢𝐧𝐢𝐧𝐠 𝐩𝐫𝐨𝐠𝐫𝐚𝐦 through whatsapp query: +91 8918633037
---------------------------------------------------------------------------------------------------------------------------------------------------------------

Рекомендации по теме
Комментарии
Автор

The movable distance (prev_idx) is not needed, just remove it from the code, it still works. Thanks

namanvijay
Автор

sir you deserve millions of likes and subscribe for your hardward. Hats off !

IshwaryaP-zojk
Автор

bestest explanation for such a question!

PriyaSharma-vu
Автор

how can you say that we need to do below 10^8 like i don't know how anyone can tell just from seeing constraints if n*n will be passed or not ?

kanaklata
Автор

I didn't understand the use of limit_idx. I tried this qestion in leetcode without using limit_idx and was able to solve all the testcase without it. Is I am missing something?

ankitmittal
Автор

I had to add the following code after line 17 of your code to ensure that one of the pointers doesn't become out of bounds. I was using Python.

if first == n or second == n:
return False

pk-zw
Автор

sir you deserve millions of likes and subscribe for your hardward. Hats off !

IshwaryaP-zojk