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

preview_player
Показать описание


Please check my playlists for free DSA problem solutions:

My Favorite Courses:

Data Structures & Algorithms:

Python:

Web Dev / Full Stack:

Cloud Development:

Game Development:

SQL & Data Science:

Machine Learning & AI:
Рекомендации по теме
Комментарии
Автор

I saw so many videos but your explanation was great for me to understand the concept. Thank you

asvlog
Автор

can you please also make videos on daily challenges of leetcode
love your videos, you teach us in nice way👍👍

NoTMaFiA
Автор

thank you for the wonderful video Greg, very useful thanks again

pravinprince
Автор

The drawing is so helpful! Can you do calculator leet code question?

LawZist
Автор

Please make videos on leetcode POTD sir

chandershekhar
Автор

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()


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 ?

BossganabathiVellow
Автор

Hi Greg could you please provide the provide the discord server link?

yygysgtyfugunvt
Автор

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()


this is my method showing error but online complier didn't show any error the reason why ?

BossganabathiVellow
Автор

return len(set(nums))
i think this gonna work, no ?

MohamedAbdallahdjedouani