Given N dots that form a triangle such that i^{th }line contains i number of dots.
    .
   . .
  . . .
 . . . .
Find the minimum hieght H of the triangle that can be formed using these N dots.
 
Example 1:
Input: N = 2
Output: 1
Explaination: The height will be 1. We 
need one dot to create first line. With 
the remaining one dot we cannot complete the 
second line.
 
Example 2:
Input: N = 10
Output: 4
Explaination: With 10 dots we can complete 
total four lines. The layers will have 1, 
2, 3 and 4 dots respectively.
 
Your Task:
You do not need to read input or print anything. Your task is to complete the function height() which takes N as input parameter and returns the height of the triangle that we can form using N dots.
 
Expected Time Comlpexity: O(1)
Expected Auxiliary Space: O(1)
 
Constraints:
1 ≤ N ≤ 10^{5}

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

Starter code:
#User function Template for python3



class Solution:

    def height(self, N):

        # code here

Solutions:
class Solution:

	def height(self, N):
		count = 1
		ans = 1
		i = 1
		while count <= N:
			count += i + 1
			i += 1
			ans += 1
		return i - 1


import math

class Solution:

	def height(self, N):
		i = 1
		while 1:
			sum_var = i * (i + 1) / 2
			if N - sum_var == 0:
				return i
			elif N - sum_var < 0:
				return i - 1
			i += 1


class Solution:

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


class Solution:

	def height(self, N):
		sum = 0
		count = 0
		for i in range(1, N + 1):
			count += 1
			sum += i
			if sum == N:
				return count
			elif sum > N:
				return count - 1


class Solution:

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


class Solution:

	def height(self, N):
		import math
		return int((-1 + math.sqrt(1 + 8 * N)) / 2)


class Solution:

	def height(self, N):
		i = 1
		h = 0
		while i <= N:
			h += 1
			N -= i
			i += 1
		return h


class Solution:

	def height(self, N):
		i = 1
		res = 1
		while res <= N:
			res += i + 1
			i += 1
		return i - 1


class Solution:

	def height(self, N):
		k = 1 + 8 * N
		p = int(k ** 0.5)
		return (p - 1) // 2


class Solution:

	def height(self, N):
		count = 1
		level = 0
		while N >= count:
			N -= count
			count += 1
			level += 1
		return level


class Solution:

	def height(self, N):
		ctr = 1
		res = 0
		while N > 0:
			res += 1
			ctr += 1
			N -= ctr
		return res


class Solution:

	def height(self, N):
		cnt = 0
		while True:
			if N <= cnt:
				break
			cnt += 1
			N = N - cnt
			if N == 0:
				break
		return cnt


import math

class Solution:

	def height(self, N):
		a = math.floor(math.sqrt(2 * N))
		dc = a * (a + 1) // 2
		while dc > N:
			a -= 1
			dc = a * (a + 1) // 2
		return a


import math

class Solution:

	def height(self, N):
		sqrt = math.sqrt(8 * N + 1)
		return math.floor((sqrt - 1) * 0.5)


class Solution:

	def height(self, n):
		s = 0
		i = 0
		while i <= n:
			s += i
			if n == s:
				break
			elif n < s:
				i -= 1
				break
			i += 1
		return i


import math

class Solution:

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


class Solution:

	def height(self, N):
		if N < 2:
			return 1
		i = 1
		while i <= N:
			N = N - i
			i += 1
		return i - 1


class Solution:

	def height(self, n):
		i = 0
		while i < n:
			i = i + 1
			n = n - i
		return i


class Solution:

	def height(self, N):
		l = 1
		r = N
		ans = 0
		while l <= r:
			x = l + (r - l) // 2
			if x / 2 <= N / (x + 1):
				ans = x
				l = x + 1
			else:
				r = x - 1
		return ans


class Solution:

	def height(self, N):
		count = 1
		lvl = 0
		while N > 0:
			N -= count
			lvl += 1
			count += 1
		if N == 0:
			return lvl
		else:
			return lvl - 1


import math

class Solution:

	def height(self, N):
		i = 1
		h = 1
		while h <= N:
			h += i + 1
			i += 1
		return i - 1


class Solution:

	def height(self, N):
		res = 0
		if N == 1:
			return 1
		for i in range(1, N):
			N -= i
			if N >= 0:
				res += 1
			else:
				return res
		return res


class Solution:

	def height(self, N):
		l = 0
		h = 1000000
		while l <= h:
			m = (l + h) // 2
			if m * (m + 1) // 2 > N:
				ans = m
				h = m - 1
			else:
				l = m + 1
		return ans - 1


class Solution:

	def height(self, N):
		a = (1 + 4 * 2 * N) ** 0.5
		return int((a - 1) / 2)


class Solution:

	def height(self, N):
		a = int((1 + 4 * 2 * N) ** 0.5)
		ans = a // 2
		if a * a == 1 + 8 * N:
			return ans
		if a % 2 != 0:
			ans += 1
		return ans - 1


class Solution:

	def height(self, N):
		s = 0
		for i in range(N + 1):
			if s + i > N:
				return i - 1
			s += i
		return N


class Solution:

	def height(self, N):
		if N <= 2:
			return 1
		D = (1 + 4 * 2 * N) ** 0.5
		root = (-1 + D) // 2
		return int(root)


class Solution:

	def height(self, N):
		a = 1
		b = 1
		while b <= N:
			b = b + a + 1
			a = a + 1
		return a - 1


from math import log

class Solution:

	def height(self, n):
		if n == 1:
			return n
		level = 0
		curr_sum = 0
		while curr_sum <= n:
			curr_sum += level + 1
			level += 1
		return level - 1