Telegram Group & Telegram Channel
Google intervyuda berilgan savolni ochiqlamaslik haqida hech qanday gap bo'lmadi. Shuning uchun bo'lishaman:

Valid parentheses (To'g'ri qavslar)

Bu masalani ko'pchiligimiz ishlaganmiz. LeetCodedagi "easy" masalalardan.

Masalan shunday string'lar berilganda funksiyamiz true/false qaytarishi kerak. String lar faqat "(" va ")" qavslaridan iborat.


"" // true
"()" // true
"(())" // true
"()()(())" // true

"())" // false
")()" // false


Intervyuda tushgan masala 2 qismdan iborat edi:

1. Check validity of input string.

2. Return valid string of parentheses.
You can delete, insert, flip a character. Return option with minimum number of edits!

1-qism oddiy, stack bilan ishlanadi. Tushuntirib o'tirmayman. Shunchaki o'zingiz ishlab ko'ring 😉

2-qism... uxxx... . Yaxshigina boshimni qotirib qo'ydi.
Demak, qavslarimiz to'g'ri bo'lsa stringni o'zini qaytaramiz. Agar noto'g'ri bo'lsa, to'g'rilab qaytaramiz.
Ya'ni har qanday holatda funksiyamizdan to'g'ri qavslardan iborat string qaytishi shart!

Eslataman, stringni to'g'rilash uchun 3 ta amal bajarish mumkin:
1. delete - o'chirish
2. flip - teskari o'girish
3. insert - qavs kiritish (ochuvchi yoki yopuvchi)

Xullas, misol keltiraman:

input = "()"
output = "()" // to'g'ri bo'lgani uchun o'zini qaytaramiz

input = "())" // 3 xil to'g'ri javob bor, istalganini qaytarish mumkin
output1 = "()" // oxirgi qavsni ochiramiz
output2 = "(())" // boshiga ochuvchi qavs qo'yamiz
output3 = "()()" // oxirgi qavsni teskari o'girib, oxiriga yopuvchi qavs qo'yamiz


Men flip - teskari o'girish amalini unutib qo'ydim va hayollarim boshqa taraflarga ketib vaqt yo'qotdim. 😖

Yechimni bera oldim. Kodini yozdim. Lekin uni "dry-run" qilib tekshirishga ulgurmadim.

Hozircha siz o'zingiz harakat qilib ko'ringchi. Keyinroq yechimini yozaman.
👍17😁6👏2🔥1



tg-me.com/brogrammist/213
Create:
Last Update:

Google intervyuda berilgan savolni ochiqlamaslik haqida hech qanday gap bo'lmadi. Shuning uchun bo'lishaman:

Valid parentheses (To'g'ri qavslar)

Bu masalani ko'pchiligimiz ishlaganmiz. LeetCodedagi "easy" masalalardan.

Masalan shunday string'lar berilganda funksiyamiz true/false qaytarishi kerak. String lar faqat "(" va ")" qavslaridan iborat.


"" // true
"()" // true
"(())" // true
"()()(())" // true

"())" // false
")()" // false


Intervyuda tushgan masala 2 qismdan iborat edi:

1. Check validity of input string.

2. Return valid string of parentheses.
You can delete, insert, flip a character. Return option with minimum number of edits!

1-qism oddiy, stack bilan ishlanadi. Tushuntirib o'tirmayman. Shunchaki o'zingiz ishlab ko'ring 😉

2-qism... uxxx... . Yaxshigina boshimni qotirib qo'ydi.
Demak, qavslarimiz to'g'ri bo'lsa stringni o'zini qaytaramiz. Agar noto'g'ri bo'lsa, to'g'rilab qaytaramiz.
Ya'ni har qanday holatda funksiyamizdan to'g'ri qavslardan iborat string qaytishi shart!

Eslataman, stringni to'g'rilash uchun 3 ta amal bajarish mumkin:
1. delete - o'chirish
2. flip - teskari o'girish
3. insert - qavs kiritish (ochuvchi yoki yopuvchi)

Xullas, misol keltiraman:

input = "()"
output = "()" // to'g'ri bo'lgani uchun o'zini qaytaramiz

input = "())" // 3 xil to'g'ri javob bor, istalganini qaytarish mumkin
output1 = "()" // oxirgi qavsni ochiramiz
output2 = "(())" // boshiga ochuvchi qavs qo'yamiz
output3 = "()()" // oxirgi qavsni teskari o'girib, oxiriga yopuvchi qavs qo'yamiz


Men flip - teskari o'girish amalini unutib qo'ydim va hayollarim boshqa taraflarga ketib vaqt yo'qotdim. 😖

Yechimni bera oldim. Kodini yozdim. Lekin uni "dry-run" qilib tekshirishga ulgurmadim.

Hozircha siz o'zingiz harakat qilib ko'ringchi. Keyinroq yechimini yozaman.

BY Brogrammist


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/brogrammist/213

View MORE
Open in Telegram


Brogrammist Telegram | DID YOU KNOW?

Date: |

Export WhatsApp stickers to Telegram on Android

From the Files app, scroll down to Internal storage, and tap on WhatsApp. Once you’re there, go to Media and then WhatsApp Stickers. Don’t be surprised if you find a large number of files in that folder—it holds your personal collection of stickers and every one you’ve ever received. Even the bad ones.Tap the three dots in the top right corner of your screen to Select all. If you want to trim the fat and grab only the best of the best, this is the perfect time to do so: choose the ones you want to export by long-pressing one file to activate selection mode, and then tapping on the rest. Once you’re done, hit the Share button (that “less than”-like symbol at the top of your screen). If you have a big collection—more than 500 stickers, for example—it’s possible that nothing will happen when you tap the Share button. Be patient—your phone’s just struggling with a heavy load.On the menu that pops from the bottom of the screen, choose Telegram, and then select the chat named Saved messages. This is a chat only you can see, and it will serve as your sticker bank. Unlike WhatsApp, Telegram doesn’t store your favorite stickers in a quick-access reservoir right beside the typing field, but you’ll be able to snatch them out of your Saved messages chat and forward them to any of your Telegram contacts. This also means you won’t have a quick way to save incoming stickers like you did on WhatsApp, so you’ll have to forward them from one chat to the other.

The STAR Market, as is implied by the name, is heavily geared toward smaller innovative tech companies, in particular those engaged in strategically important fields, such as biopharmaceuticals, 5G technology, semiconductors, and new energy. The STAR Market currently has 340 listed securities. The STAR Market is seen as important for China’s high-tech and emerging industries, providing a space for smaller companies to raise capital in China. This is especially significant for technology companies that may be viewed with suspicion on overseas stock exchanges.

Brogrammist from sg


Telegram Brogrammist
FROM USA