java

    May LeetCoding Challenge[Day9] - Valid Perfect Square

    Given a positive integer num, write a function which returns True if num is a perfect square else False. Note: Do not use any built-in library function such as sqrt. Input: 16 Output: true 1. 알고리즘을 해결하기 위해서 생각한 방법 - 해당 문제는 input 숫자가 n*n 인 숫자인가에 관련된 문제이다. - 특정 숫자를 고르는 것이기 때문에, 이진탐색을 생각했다. - 특정 숫자를 고르는 문제와 같이, 이진탐색을 하는 조건을 알게 되었다. - 1~N까지 범위가 주어졌을 때, 숫자 하나를 선택할 때 가장 빠르게 찾기 위해서는 가장 적합하다고 생각하게 되었다. ..

    Leetcode[day22] - Bitwise AND of Numbers Range

    Given a range [m, n] where 0 > 1; shift++; } return n