Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
Mohammed Dh Abbas
A better solution

Mohammed Dh Abbas

Jul 20, 2024

class Solution:   def findNumber(self, nums):         def swap(i, j):       nums[i], nums[j] = nums[j], nums[i]     for i in range(len(nums)):       while nums[i] != i + 1 and nums[i] != nums[nums[i] - 1]:         swap(i, nums[i] - 1)     return nums[-1]

0

0

Comments
Comments

On this page