The Coding Puzzle 🧩
Last week’s puzzle:
Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once. The relative order of the elements should be kept the same.
Solution for last week’s problem:
class Solution: def removeDuplicates(self, nums: List[int]) -> int: """ :type nums: List[int] :rtype: int """ len_ = 1 if len(nums)==0: return 0 for i in range(1,len(nums)): if nums[i] != nums[i-1]: nums[len_] = nums[i] len_ +=1 return len_
This week’s puzzle:
Given a string, write a function to check if it is a permutation of a palindrome. A palindrome is a word or phrase that is the same forwards and backwards. A permutation is a rearrangement of letters. The palindrome does not need to be limited to just dictionary words.
Developer Shares & Headlines 📢
Want to recommend someone for our developer spotlight, developer event, or just say hello? Send us an email at email@example.com we want to hear from you!
The DLU Team