Тёмный
No video :(

Product of array except self (LeetCode 238) | Neetcode 7 / 150 | Bharath Chandra (Telugu) 

Bharath Chandra (తెలుగు)
Подписаться 7 тыс.
Просмотров 1,5 тыс.
50% 1

Hello guys, cheers to another piece of learning. Today I talked about the "Product of array except self" problem which is the first in Neetcode 150 list. It is one of the most asked questions in interviews and has some interesting ways to solve it.
In the above video, I showed all the different logics with which the problem can be solved and also the codes to those logics in Python. Let me know if you got a hold of the logic?
Link to Prefix sum - • Prefix Sum Arrays| Pro...
Link to the problem - leetcode.com/p...
Link to Neetcode 150 - neetcode.io/pr...
Regular updates from me on Discord, Insta and Telegram. I post job notifications of telegram and discord
Insta - / bharathh_chandraa
Telegram - t.me/thebharat...
Discord - / discord
LinkedIn - / lokesh-bharath-chandra...
00:00 - Introduction and Problem Explanation
02:12 - Straight forward approach
05:47 - Brute Force
11:43 - Optimisation
18:59 - Pseudocode
21:16 - Bonus question
28:16 - Conclusion

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

 

17 авг 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 15   
@niramalakanukolanu3222
@niramalakanukolanu3222 Месяц назад
Bro I Have Doubt How It Would Be suffix[0]= 1 it is 24 kadha
@bharathh_chandraa
@bharathh_chandraa Месяц назад
Avunu Niramala, Thanks for pointing this out. It is 24, my mistake. Luckily, it did not change any answers
@electron-u8p
@electron-u8p Месяц назад
7/150 ✅️
@lohithaadapala6989
@lohithaadapala6989 Месяц назад
Ah! Found the perfect channel! Thankyou🙏
@tradeiteasyy
@tradeiteasyy 20 дней назад
Idea : iterate Evey element and get the left product and right product and multiply them and store the value in result array .
@vaneetha_here_navaneetha
@vaneetha_here_navaneetha 29 дней назад
class Solution: def productExceptSelf(self, nums): n=len(nums) suffix=[1]*n suffix[n-1]=nums[n-1] for i in range(n-2,-1,-1): suffix[i]=suffix[i+1]*nums[i] for i in range(1,n): nums[i] = nums[i-1] *nums[i] for i in range(n): if i==0: suffix[i]=suffix[i+1] elif i==(n-1): suffix[i]=nums[-2] else: suffix[i]=(suffix[i+1] * nums[i-1]) return suffix
@vaneetha_here_navaneetha
@vaneetha_here_navaneetha 29 дней назад
class Solution: def productExceptSelf(self, nums): n=len(nums) prefix=[1]*n prefix[0]=nums[0] for i in range(1,len(nums)): prefix[i]=prefix[i-1]*nums[i] suffix=[1]*n suffix[n-1]=nums[n-1] for i in range(n-2,-1,-1): suffix[i]=suffix[i+1]*nums[i] l=[] for i in range(len(nums)): if i==0: l.append(suffix[i+1]) elif i==(n-1): l.append(prefix[n-2]) else: l.append(suffix[i+1] * prefix[i-1]) return l after watching video
@Manipinnaka
@Manipinnaka Месяц назад
Baga chepav bro❤
@SaiBharath_Kanasani12
@SaiBharath_Kanasani12 Месяц назад
Hi bro, I have got the O(1) approach you told me in the last part of the video, but I am having a hard time coding that approach. can you tell me the code for that approach it would be helpful. Thank You!
@lohithaadapala6989
@lohithaadapala6989 Месяц назад
class Solution { public int[] productExceptSelf(int[] nums) { int n = nums.length; int[] output = new int[n]; output[n-1] = nums[n-1]; for(int i=n-2;i>=0;i--){ output[i] = output[i+1] * nums[i]; } for(int i=1;i
@vaneetha_here_navaneetha
@vaneetha_here_navaneetha Месяц назад
class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: c=nums l=[] for j in range(len(nums)): n = c[:j]+c[j+1:] p=1 for i in n: p=p*i l.append(p) return l before starting the video
@KumarTatikonda
@KumarTatikonda Месяц назад
Thumbnail loo leet code symbol pettu Anna Inka perugutgadi reach
@bharathh_chandraa
@bharathh_chandraa Месяц назад
Nice idea Kumar❤. Add chesestha next nunchi
@user-ir5mm9pt8v
@user-ir5mm9pt8v Месяц назад
Waiting anna
@VincentVamsi
@VincentVamsi Месяц назад
Далее
Product of Array Except Self - Leetcode 238 - Python
11:54