@@ -0,0 +1,1025 @@
+# Time:  O(sqrt(n))%0A# Space: O(1)%0A%0A# You are standing at position 0 on an infinite number line. There is a goal at position target.%0A#%0A# On each move, you can either go left or right.%0A# During the n-th move (starting from 1), you take n steps.%0A#%0A# Return the minimum number of steps required to reach the destination.%0A#%0A# Example 1:%0A# Input: target = 3%0A# Output: 2%0A# Explanation:%0A# On the first move we step from 0 to 1.%0A# On the second step we step from 1 to 3.%0A#%0A# Example 2:%0A# Input: target = 2%0A# Output: 3%0A# Explanation:%0A# On the first move we step from 0 to 1.%0A# On the second move we step  from 1 to -1.%0A# On the third move we step from -1 to 2.%0A#%0A# Note:%0A# - target will be a non-zero integer in the range %5B-10%5E9, 10%5E9%5D.%0A%0Aclass Solution(object):%0A    def reachNumber(self, target):%0A        %22%22%22%0A        :type target: int%0A        :rtype: int%0A        %22%22%22%0A        target = abs(target)%0A        k = 0%0A        while target %3E 0:%0A            k += 1%0A            target -= k%0A        return k if target%252 == 0 else k+1+k%252%0A        %0A

Create reach-a-number.py