Given a number N. Print the minimum positive integer by which it should be divided so that the result is an odd number.
Example 1:
Input:
N = 36
Output:
4
Explanation:
36 must be divided by 4 or 12 to make it
odd. We take minimum of 4 and 12 i.e. 4.
Example 2:
Input:
N = 5
Output:
1
Explanation:
5 is already odd.
Your Task:  
You don't need to read input or print anything. Your task is to complete the function makeNumberOdd() which takes an integer N as an input parameter and return the minimum positive integer by which it should be divided so that the result is an odd number.
Expected Time Complexity: O(LogN)
Expected Auxiliary Space: O(1)
Constraints:
1 <= N <= 100000

Source: geeksforgeeks | Difficulty: EASY
Tags: Mathematics

Starter code: #User function Template for python3
class Solution:
	def makeNumberOdd(self, N):
		# code here

Solutions:
class Solution:

	def makeNumberOdd(self, N):
		k = 0
		for i in range(1, N + 1):
			if N % i == 0 and N // i % 2 == 1:
				return i


class Solution:

	def makeNumberOdd(self, N):

		def helper(n):
			if n % 2:
				return 1
			return 2 * helper(n // 2)
		return helper(N)


class Solution:

	def makeNumberOdd(self, N):
		for i in range(1, N + 1):
			if N % i == 0:
				r = N / i
				if int(r) % 2 != 0:
					return i


class Solution:

	def makeNumberOdd(self, N):
		if N % 2 != 0:
			return 1
		else:
			f = []
			for i in range(1, N + 1):
				if N % i == 0:
					f.append(i)
			k = []
			for i in range(len(f)):
				res = N // f[i]
				k.append(res)
			for i in range(len(k)):
				if k[i] % 2 != 0:
					return f[i]
					break


class Solution:

	def makeNumberOdd(self, N):
		b = N
		if N % 2 != 0:
			return 1
		while b > 0 and b % 2 == 0:
			b = b // 2
		return N // b


class Solution:

	def makeNumberOdd(self, N):
		c = 1
		while N % 2 != 1:
			N //= 2
			c *= 2
		return c


class Solution:

	def makeNumberOdd(self, N):
		if N % 2 == 1:
			return 1
		mini = 10 ** 9 + 7
		for i in range(2, int(N // 2) + 1):
			if N % i == 0 and N // i % 2 == 1:
				return i
		return N


import math

class Solution:

	def makeNumberOdd(self, N):
		for x in range(1, N + 1):
			if N % x == 0:
				r = N / x
				if int(r) % 2 != 0:
					return x