Created
August 29, 2024 15:56
-
-
Save AashishNandakumar/e03c45801fd916f09947dc3cd47e11f1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
#User function Template for python3 | |
#Complete this function | |
def findFloor(self,A,N,X): | |
#Your code here | |
nums = A | |
x = X | |
n = N | |
l = 0 | |
r = n-1 | |
mem = -1 | |
while l <= r: | |
mid = (l+r) // 2 | |
if nums[mid] <= x: | |
mem = mid | |
l = mid + 1 | |
else: | |
r = mid - 1 | |
return mem |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment