Тёмный

K Inverse Pairs Array 🔥🔥| Leetcode June challenge | Leetcode 629 | Approach + Code | C++ | Hindi 

Ayushi Sharma
Подписаться 45 тыс.
Просмотров 10 тыс.
50% 1

Опубликовано:

 

28 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 36   
@arishrehmankhan
@arishrehmankhan 3 года назад
at 4:28 [1, 4, 3, 2] will give k = 3,
@AyushiSharmaDSA
@AyushiSharmaDSA 3 года назад
Yes, by mistake. [1, 3,4,2] will come. Thanks for pointing out. 😀😀👍🏻
@avkumar1764
@avkumar1764 2 года назад
Nice explanation but aap do dp kyu initialised ki ho?? Ek bahar and ek function ke ander... And esse time complexity v reduce hi ja rhe hai...kaise?
@ANUJ-we3su
@ANUJ-we3su 2 года назад
mam wo minimum wala last m smjh nhi aaya why you have taken min(k,n-1) if you are explaining at max it will go to k
@iampatelajeet
@iampatelajeet 2 года назад
Hi Ayushi di, adding the complexities int the github code would really helpful.
@aishwaryaranghar3385
@aishwaryaranghar3385 2 года назад
nice intuition
@AyushiSharmaDSA
@AyushiSharmaDSA 2 года назад
Thanks 😊
@ueditz6807
@ueditz6807 2 года назад
Many people watching this due to daily challenge 😂
@pranavsingh1081
@pranavsingh1081 2 года назад
SAHI KAHA
@sajalgupta3553
@sajalgupta3553 2 года назад
why [3, 1, 2 ] is not included in answer of second testcase ?? Can anyone explain?
@RohitKumar-qh5bq
@RohitKumar-qh5bq 2 года назад
because it contains 2 inverse pairs 3---1 and 3---2 but in testcase it is clearly written that we need k = 1
@oqant0424
@oqant0424 2 года назад
Great explanation dee...thanks ❤️
@AyushiSharmaDSA
@AyushiSharmaDSA 2 года назад
Welcome 🤗
@peop.9658
@peop.9658 2 года назад
amazing
@AyushiSharmaDSA
@AyushiSharmaDSA 2 года назад
Thanks 😊
@rohitvijaynikhare5637
@rohitvijaynikhare5637 2 года назад
Hey hi, why we are taking min(K,N-1) we can take like i
@priyanshumohanty5261
@priyanshumohanty5261 2 года назад
Yeah same doubt, that last part explanation for it was a bit vague
@AkashSingh-xj8ug
@AkashSingh-xj8ug 2 года назад
When we have k>n then when we place n as first element then total n-1 inversion will made and we can't make more inversion than n-1. So till the k
@Naaz-2002
@Naaz-2002 3 года назад
Thanks Di! Helped a lot, github m jo code h usme ek for loop miss hogya fix krdo
@AyushiSharmaDSA
@AyushiSharmaDSA 3 года назад
Welcome :). And yes , thanks for letting me know, Fixed the code on github😀
@oqant0424
@oqant0424 2 года назад
When dp[n][k]==0 Then why we did dp[n][k]==1 and then ran the for loop?
@shyamjitiwari7519
@shyamjitiwari7519 2 года назад
for k=0
@oqant0424
@oqant0424 2 года назад
@@shyamjitiwari7519 then why at end we subtracted 1...jab subtraction hi Krna tha to add kyu kiya
@shyamjitiwari7519
@shyamjitiwari7519 2 года назад
@@oqant0424 fair enough, then don't make it 1. class Solution { public: int dp[1001][1001] = {0}; int kInversePairs(int n, int k) { if (k
@AakashKumar-vf3dh
@AakashKumar-vf3dh Год назад
She explained it wrong. We put 1 in order to avoid recomputation of that value. If not marked as 1 it would be computed multiple times in the recursive solution and the time complexity would be exponential.
@ragingpahadi
@ragingpahadi 3 года назад
Beautiful explanation simple and easy to get on !
@AyushiSharmaDSA
@AyushiSharmaDSA 3 года назад
Thank you 🙂
@algorithmo134
@algorithmo134 3 года назад
Can you make this in english?
@AyushiSharmaDSA
@AyushiSharmaDSA 3 года назад
Sorry, This leetcode challenge series, I have started in Hindi, But in future, the series will be in English. Really sorry😓
@gamingwithasmile268
@gamingwithasmile268 9 месяцев назад
2 3 1 why not?
@411_danishranjan9
@411_danishranjan9 2 года назад
now this code is giving TLE
@manasdeora4601
@manasdeora4601 2 года назад
ekdum smjh ni aya
@vipulchaudhary_js
@vipulchaudhary_js 2 года назад
Same here. Happens bro. But she makes great videos.
@naveengarg7435
@naveengarg7435 2 года назад
please like karna bolne se pahle code optimized kar na!
@harmanjeetsingh3556
@harmanjeetsingh3556 2 года назад
Focus on your job. Stop teaching like that
@pranavsingh1081
@pranavsingh1081 2 года назад
ABE TU APNA KAR NA TU SIKHAYEGA KON KYA KAREGA
Далее
K Inverse Pairs Array - Leetcode 629 - Python
29:44
Просмотров 16 тыс.
🎙А НЕ СПЕТЬ ли мне ПЕСНЮ?🕺🏼
3:06:10
Contiguous array | Leetcode #525
13:12
Просмотров 56 тыс.