Remove Duplicates From Sorted Array - Leetcode 26 - Arrays & Strings (Python)

  Рет қаралды 6,911

Greg Hogg

Greg Hogg

Күн бұрын

Пікірлер: 17
@GregHogg
@GregHogg 3 ай бұрын
Master Data Structures & Algorithms for FREE at AlgoMap.io/
@asvlog425
@asvlog425 2 ай бұрын
I saw so many videos but your explanation was great for me to understand the concept. Thank you
@pravinprince3221
@pravinprince3221 3 ай бұрын
thank you for the wonderful video Greg, very useful thanks again
@NoTMaFiA24
@NoTMaFiA24 3 ай бұрын
can you please also make videos on daily challenges of leetcode love your videos, you teach us in nice way👍👍
@LawZist
@LawZist 3 ай бұрын
The drawing is so helpful! Can you do calculator leet code question?
@benhurthandu6821
@benhurthandu6821 16 күн бұрын
why the error 'return' outside function?
@chandershekhar9251
@chandershekhar9251 3 ай бұрын
Please make videos on leetcode POTD sir
@yygysgtyfugunvt
@yygysgtyfugunvt 3 ай бұрын
Hi Greg could you please provide the provide the discord server link?
@BossganabathiVellow
@BossganabathiVellow 3 ай бұрын
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-z5u
@MaksymOliinyk-z5u 3 ай бұрын
hi, you need to modify exactly the nums array that you have in your function, you should not create any new arrays
@BossganabathiVellow
@BossganabathiVellow 3 ай бұрын
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 ?
@amlet00
@amlet00 3 ай бұрын
because you need do it in-place, that means you cannot use any extra space
@BossganabathiVellow
@BossganabathiVellow 3 ай бұрын
@@amlet00 Thank you sir
@tejas8211
@tejas8211 2 ай бұрын
This ain't easy mannnnn
@MohamedAbdallahdjedouani
@MohamedAbdallahdjedouani 3 ай бұрын
return len(set(nums)) i think this gonna work , no ?
@GregHogg
@GregHogg 3 ай бұрын
Yeah you should read the question again haha
@SwizzRizzBizz
@SwizzRizzBizz 2 ай бұрын
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
Making an Algorithm Faster
30:08
NeetCodeIO
Рет қаралды 147 М.
Remove Duplicates from Sorted Array - Leetcode 26 - Python
10:38
Noodles Eating Challenge, So Magical! So Much Fun#Funnyfamily #Partygames #Funny
00:33
Don't underestimate anyone
00:47
奇軒Tricking
Рет қаралды 15 МЛН
Миллионер | 3 - серия
36:09
Million Show
Рет қаралды 2 МЛН
Coin Change - Leetcode 322 - Dynamic Programming (Python)
15:27
Reacting to Controversial Opinions of Software Engineers
9:18
Fireship
Рет қаралды 2,1 МЛН
LeetCode was HARD until I Learned these 15 Patterns
13:00
Ashish Pratap Singh
Рет қаралды 577 М.
Remove Duplicates from Sorted Array II - Leetcode 80 - Python
12:19
8 patterns to solve 80% Leetcode problems
7:30
Sahil & Sarra
Рет қаралды 438 М.
Learn to code with an unfair advantage.
15:05
Jason Goodison
Рет қаралды 175 М.
Climbing Stairs - Leetcode 70 - Dynamic Programming (Python)
10:54
Noodles Eating Challenge, So Magical! So Much Fun#Funnyfamily #Partygames #Funny
00:33