Nawat Sunthornyanakitearthcode.hashnode.dev·8 hours agoGroup Anagrams (Leetcode #49)Question: Given an array of strings strs, group the anagrams together. You can return the answer in any order. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters ex...Discussleetcode

Nawat Sunthornyanakitearthcode.hashnode.dev·8 hours agoContains Duplicate (Leetcode #217)Question Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct. Example 1: Input: nums = [1,2,3,1] Output: true Example 2: Input: nums = [1,2,3,4] Output: false Exam...Discussleetcode

Nawat Sunthornyanakitearthcode.hashnode.dev·8 hours agoValid Anagram (Leetcode #242)Question: Given two strings s and t, return true if t is an anagram of s, and false otherwise. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. Exam...DiscussPython

Tapan Rachchhtapanrachchh.hashnode.dev·11 hours ago945. Minimum Increment to Make Array Uniqueclass Solution: def minIncrementForUnique(self, nums: List[int]) -> int: nums.sort() ans = 0 for i in range(len(nums) - 1): if nums[i] >= nums[i + 1]: ans += 1 + (nums[i] - nums[i + 1]) ...DiscussPython

Nawat Sunthornyanakitearthcode.hashnode.dev·Jun 13, 2024Two Sum (Leetcode #1)Question: Given an array of integers nums and an integer target, return the indices of the two numbers such that they add up to the target. Constraints: Each input would have exactly one solution. The same element cannot be used twice. Examples: ...Discussleetcode

Tapan Rachchhtapanrachchh.hashnode.dev·Jun 13, 20242037. Minimum Number of Moves to Seat Everyoneclass Solution: def minMovesToSeat(self, seats: List[int], students: List[int]) -> int: seats.sort() students.sort() diff = 0 for i in range(len(seats)): diff += abs(seats[i] - students[i]) re...DiscussPython

Tapan Rachchhtapanrachchh.hashnode.dev·Jun 12, 202475. Sort Colorsclass Solution: def sortColors(self, nums: List[int]) -> None: c = Counter(nums) count = [] for e in range(3): count += [e] * c[e] for i in range(len(nums)): nums[i] = count[i]Discussleetcode

Ishan Bhusariishanbhusari.hashnode.dev·Jun 12, 2024129. Detailed Solution for Solving "129. Sum Root To Leaf Numbers"(Note: I think it's a testament nowadays to not copy answers directly from ChatGPT. On that note, I'd like to inform the readers that the below answer has not been derived from ChatGPT nor has it been proofread or even checked grammatically by the so...Discussdata structures

Riddhi Kakkadriddhikakkad.hashnode.dev·Jun 12, 2024💡Top 15 Websites Every Computer Engineer Should BookmarkAs a computer engineer, staying current with industry trends, continuously honing your skills, and networking with fellow professionals are essential aspects of your career development. To help you navigate through this dynamic field, here is a curat...Discuss·10 likes·27 readsStack Overflow

Tapan Rachchhtapanrachchh.hashnode.dev·Jun 10, 20241051. Height Checkerclass Solution: def heightChecker(self, heights: List[int]) -> int: minVal = float('inf') maxVal = 0 freq = defaultdict(int) for height in heights: freq[height] += 1 minVal = min(minVal, he...Discusscounter-sort