Last active
December 6, 2021 08:05
-
-
Save ylt6/96ea54e6a0f26596d3bcaeecbab6456f to your computer and use it in GitHub Desktop.
Revisions
-
ylt6 renamed this gist
Dec 6, 2021 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
ylt6 revised this gist
Dec 6, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # https://www.facebookrecruiting.com/portal/coding_puzzles/?puzzle=348371419980095 from typing import List # Write any import statements here -
ylt6 created this gist
Dec 6, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ // https://www.facebookrecruiting.com/portal/coding_puzzles/?puzzle=348371419980095 from typing import List # Write any import statements here def getMinProblemCount(N: int, S: List[int]) -> int: # Write your code here is_even = lambda x: True if x % 2 == 0 else False max_v = float('-inf') has_odd = False for n in S: if n > max_v: max_v = n if not has_odd and not is_even(n): has_odd = True return max_v // 2 + 1 if has_odd else max_v // 2