Given N number of square blocks. The height of each square block is 1. The task is to create a  staircase of max height using these blocks.
Note: The first stair would require only one block, the second stair would require two blocks and so on.
Example 1:
Input:
N = 10
Output:
4
Explanation:
The max height of the stairs with
10 blocks is 4.
Example 2:
Input:
N = 16
Output:
5
Explanation:
The max height of the stairs with
16 blocks is 5.
Your Task:
You don't need to read input or print anything. Your task is to complete the function maxStairHeight() which takes an Integer N as input and returns the answer.
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
Constraints:
1 <= N <= 10^{8}

Difficulty: EASY
Tags: Mathematics
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3

class Solution:
    def maxStairHeight(self, N):
        # code here

Solutions:
import math

class Solution:

	def maxStairHeight(self, N):
		a = int(math.sqrt(2 * N))
		for i in range(a, 0, -1):
			if i * (i + 1) <= 2 * N:
				return i


import math

class Solution:

	def maxStairHeight(self, N):
		output = -0.5 + math.sqrt(0.25 + 2 * N)
		return int(output)


import math

class Solution:

	def maxStairHeight(self, N):
		x = (math.sqrt(1 + 8 * N) - 1) / 2
		return int(x)


class Solution:

	def maxStairHeight(self, N):
		return int((-1 + pow(1 + 8 * N, 0.5)) / 2)


class Solution:

	def maxStairHeight(self, N):
		if N == 1:
			return 1
		return int((-1 + (1 + 8 * N) ** 0.5) / 2)
		for i in range(1, N):
			if i * (i + 1) // 2 > N:
				break
		return i - 1


import math

class Solution:

	def maxStairHeight(self, N):
		x = int(math.sqrt(1 + 8 * N))
		(v1, v2) = ((-1 + x) // 2, (-1 - x) // 2)
		return max(v1, v2)


class Solution:

	def maxStairHeight(self, N):
		return int((2 * N + 0.25) ** 0.5 - 0.5)


import math

class Solution:

	def maxStairHeight(self, n):
		n = 8 * n + 1
		c = math.sqrt(n)
		c = c - 1
		c = c // 2
		return int(c)


import math

class Solution:

	def maxStairHeight(self, N):
		return int((math.sqrt(1 + 8 * N) - 1) / 2)
import math
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = int(input())
		ob = Solution()
		print(ob.maxStairHeight(N))


class Solution:

	def maxStairHeight(self, A):
		(l, r, curr) = (1, A, 1)
		if A == 0:
			return 0
		while l <= r:
			mid = l + (r - l) // 2
			if mid * (mid + 1) // 2 <= A:
				curr = mid
				l = mid + 1
			else:
				r = mid - 1
		return curr
import math
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = int(input())
		ob = Solution()
		print(ob.maxStairHeight(N))


class Solution:

	def maxStairHeight(self, N):
		if N == 0:
			return 0
		low = 1
		high = N
		while high - low > 1:
			mid = low + (high - low) // 2
			x = mid * (mid + 1) // 2
			if x == N:
				return mid
			elif x > N:
				high = mid
			else:
				low = mid
		return low


import math

class Solution:

	def maxStairHeight(self, N):
		val = math.sqrt(1 + 8 * N) - 1
		val //= 2
		return math.floor(val)


import math

class Solution:

	def maxStairHeight(self, N):
		tmpN = int(math.floor(math.sqrt(2 * N)))
		if tmpN * (tmpN + 1) // 2 <= N:
			return tmpN
		else:
			return tmpN - 1


class Solution:

	def maxStairHeight(self, N):
		(l, r) = (0, N)
		while l <= r:
			mid = l + r >> 1
			if mid * (mid + 1) / 2 > N:
				r = mid - 1
			else:
				l = mid + 1
		return r


class Solution:

	def maxStairHeight(self, N):
		val = (-1 + math.sqrt(8 * N + 1)) // 2
		return int(val)


import math as m

class Solution:

	def maxStairHeight(self, N):
		ans = int((m.sqrt(N * 8 + 1) - 1) // 2)
		return ans


from math import sqrt

class Solution:

	def maxStairHeight(self, N):
		r = 1 + 8 * N
		if r > 0:
			x1 = (-1 + sqrt(r)) / 2
			x2 = (-1 - sqrt(r)) / 2
			if x1 > 0:
				return int(x1)
			elif x2 > 0:
				return int(x2)
			else:
				return 0
		elif r == 0:
			x = -1 / 2 * 1
			return int(x)
		elif r < 0:
			return 0


import numpy as np

class Solution:

	def maxStairHeight(self, N):
		k = int(np.sqrt(2 * N))
		if k == 0:
			return 0
		if N - k * (k + 1) / 2 >= 0:
			return k
		else:
			return k - 1


class Solution:

	def maxStairHeight(self, N):
		ans = int(math.sqrt(2.0 * N + 0.25) - 0.5)
		return ans


class Solution:

	def maxStairHeight(self, N):
		r = int((N * 2) ** (1 / 2))
		if r * (r + 1) // 2 > N:
			return r - 1
		return r


import math

class Solution:

	def maxStairHeight(self, N):
		return int(((1 + 8 * N) ** 0.5 - 1) / 2)


class Solution:

	def maxStairHeight(self, N):
		k = math.floor(math.sqrt(2 * N))
		c = k * (k + 1) / 2
		while c <= N:
			k += 1
			c = k * (k + 1) / 2
		return k - 1


class Solution:

	def maxStairHeight(self, N):
		x = (-1 + math.sqrt(1 + 4 * 2 * N)) / 2
		return int(x)


class Solution:

	def maxStairHeight(self, N):
		h = int(math.sqrt(N * 2))
		temp = h * (h + 1) // 2
		if temp > N:
			h -= 1
		return h


class Solution:

	def maxStairHeight(self, N):
		x = int((-1 + (1 + 8 * N) ** (1 / 2)) // 2)
		y = int((-1 - (1 + 8 * N) ** (1 / 2)) // 2)
		if x > 0:
			return x
		elif y > 0:
			return y


class Solution:

	def maxStairHeight(self, N):
		disc = 1 + 8 * N
		root = disc ** 0.5
		return int((root - 1) / 2)


class Solution:
	import math

	def maxStairHeight(self, N):
		a = 1
		b = 1
		c = -2 * N
		d = b * b - 4 * a * c
		ans = (-b + pow(d, 0.5)) // 2 * a
		return math.floor(ans)


class Solution:

	def maxStairHeight(self, N):
		s = 0
		i = 1
		aa = int((1 + 8 * N) ** 0.5)
		res = (aa - 1) // 2
		return res