Master Data Structures & Algorithms for FREE at AlgoMap.io/
@asvlog4252 ай бұрын
I saw so many videos but your explanation was great for me to understand the concept. Thank you
@pravinprince32213 ай бұрын
thank you for the wonderful video Greg, very useful thanks again
@NoTMaFiA243 ай бұрын
can you please also make videos on daily challenges of leetcode love your videos, you teach us in nice way👍👍
@LawZist3 ай бұрын
The drawing is so helpful! Can you do calculator leet code question?
@benhurthandu682116 күн бұрын
why the error 'return' outside function?
@chandershekhar92513 ай бұрын
Please make videos on leetcode POTD sir
@yygysgtyfugunvt3 ай бұрын
Hi Greg could you please provide the provide the discord server link?
@BossganabathiVellow3 ай бұрын
class Solution(object): def removeDuplicates(self, nums): """ :type nums: List[int] :rtype: int """ a = [] for num in nums: if num not in a: a.append(num) return len(a) nums = [1,1,2] solve = Solution() print(solve.removeDuplicates(nums)) this is my method when running in online complier no error showing but when runs in leetcode showing error. Sir can explain me why this can happend ?
@MaksymOliinyk-z5u3 ай бұрын
hi, you need to modify exactly the nums array that you have in your function, you should not create any new arrays
@BossganabathiVellow3 ай бұрын
class Solution(object): def removeDuplicates(self, nums): """ :type nums: List[int] :rtype: int """ a = [] for num in nums: if num not in a: a.append(num) return len(a) nums = [1,1,2] solve = Solution() print(solve.removeDuplicates(nums)) this is my method showing error but online complier didn't show any error the reason why ?
@amlet003 ай бұрын
because you need do it in-place, that means you cannot use any extra space
@BossganabathiVellow3 ай бұрын
@@amlet00 Thank you sir
@tejas82112 ай бұрын
This ain't easy mannnnn
@MohamedAbdallahdjedouani3 ай бұрын
return len(set(nums)) i think this gonna work , no ?
@GregHogg3 ай бұрын
Yeah you should read the question again haha
@SwizzRizzBizz2 ай бұрын
Wont work because sets are unordered and the question asks to keep the order of the given array! So you cannot use a set data structure