Given a street of N houses (a row of houses), each house having K amount of money kept inside; now there is a thief who is going to steal this money but he has a constraint/rule that he cannot steal/rob two adjacent houses. Find the maximum money he can rob. 
Example 1:
Input:
N = 5 , K = 10
Output:
30
Explanation:
The Robber can rob from the first, third
and fifth houses which will result in 30.
Example 2:
Input:
N = 2 , K = 12
Output:
12
Explanation:
The Robber can only rob from the first
or second which will result in 12.
Your Task:
You don't need to read input or print anything. Your task is to complete the function maximizeMoney() which takes 2 Integers N and K as input and returns the answer.
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
Constraints:
1 <= N,K <= 10^{3}

Source: geeksforgeeks | Difficulty: EASY
Tags: Mathematics

Starter code: #User function Template for python3



class Solution:

    def maximizeMoney(self, N , K):

        # code here 

Solutions:
class Solution:

	def maximizeMoney(self, N, K):
		i = 1
		su = 0
		while i <= N:
			su = su + K
			i += 2
		return su


class Solution:

	def maximizeMoney(self, N, K):
		j = []
		i = 0
		c = 0
		while i < N:
			if i % 2 == 0:
				j.append(1)
				c = c + 1
			else:
				j.append(0)
			i = i + 1
		return c * K


class Solution:

	def maximizeMoney(self, N, K):
		if N % 2 == 0:
			return N // 2 * K
		return (N // 2 + 1) * K


class Solution:

	def maximizeMoney(self, N, K):
		return (N // 2 + N % 2) * K


class Solution:

	def maximizeMoney(self, N, K):
		sum = 0
		for i in range(0, N, 2):
			sum += K
		return sum


class Solution:

	def maximizeMoney(self, N, K):
		i = 1
		c = 0
		while i < N + 1:
			if i % 2 != 0:
				c = c + 1
			i += 1
		return c * K


class Solution:

	def maximizeMoney(self, N, K):
		count = K * ((N + 1) // 2)
		return count


class Solution:

	def maximizeMoney(self, N, K):
		count = 0
		for i in range(1, N + 1):
			if i % 2 != 0:
				count += K
		return count


import math

class Solution:

	def maximizeMoney(self, N, K):
		return math.ceil(N / 2) * K


class Solution:

	def maximizeMoney(self, N, K):
		if N % 2 != 0:
			a = int((N + 1) / 2)
		else:
			a = int(N / 2)
		return a * K


import math

class Solution:

	def maximizeMoney(self, N, K):
		a = math.floor((N + 1) / 2)
		return a * K


class Solution:

	def maximizeMoney(self, N, K):
		if N == 1 or N == 2:
			return K
		elif N % 2 == 0:
			return N // 2 * K
		else:
			return (N // 2 + 1) * K


class Solution:

	def maximizeMoney(self, N, K):
		s = 0
		for i in range(1, N + 1, 2):
			s += K
		return s


class Solution:

	def maximizeMoney(self, N, K):
		a = []
		for i in range(1, N + 1, 2):
			a.append(i)
		return len(a) * K


class Solution:

	def maximizeMoney(self, N, K):
		l = [K] * N
		a = 0
		for i in range(0, N, 2):
			a += K
		b = 0
		for i in range(1, N, 2):
			b += K
		return max(b, a)


class Solution:

	def maximizeMoney(self, N, k):
		if N % 2 != 0:
			n = N // 2 + 1
			return n * k
		else:
			n = N // 2
			return n * k


class Solution:

	def maximizeMoney(self, N, K):
		return (N >> 1) * K + K * (N & 1)


class Solution:

	def maximizeMoney(self, N, K):
		q = N // 2
		r = N % 2
		return q * K + r * K


class Solution:

	def maximizeMoney(self, N, K):
		return int((N + 1) / 2) * K


class Solution:

	def maximizeMoney(self, N, K):
		n = N // 2
		b = (N - n) * K
		return b


class Solution:

	def maximizeMoney(self, n, k):
		s = 0
		for i in range(1, n + 1):
			if i % 2 != 0:
				s += 1
		return s * k


class Solution:

	def maximizeMoney(self, N, K):
		m = (N - 1) // 2 + 1
		return K * m


class Solution:

	def maximizeMoney(self, N, K):
		if N % 2 != 0:
			N = N - N // 2
			return K * N
		else:
			N = N // 2
			return K * N