Problem Leetcode 374. Guess Number Higher or Lower - Binary Search Level: Easy Link Guess Number Higher or Lower - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com My Code 기본적인 Binary Search 문제이다. n = 2, pick = 2, n=1, pick 1 처럼 interval이 얼마 차이 나지 않는 경우들에 대한 조건처리가 잘 되어야 한다. # The gu..
Problem Leetcode 278: First Bad version Level: Easy Link First Bad Version - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com My Code 기본적인 이진탐색 문제다. 이진 탐색을 진행해주며 가장 먼저 발생하는 bad version을 체크해준다. # The isBadVersion API is already defined for you. # @param version, an integer # @return ..
문제 Leetcode 58: Length of Last word Level: Easy Link Length of Last Word - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 나의 풀이 쉬워보이지만 반례가 많아서 세심한 디버깅이 필요한 문제다. 받은 스트링 값을 " "로 split해주고, 뒤에서부터 탐색하며 길이가 0이 아닌 element를 리턴해준다. class Solution: def lengthOfLastWord(self, s: str) -> int:..