[Easy] 1281. Subtract the Product and Sum of Digits of an Integer
leetCode 2022. 5. 26. 11:53

문제 Given an integer number n, return the difference between the product of its digits and the sum of its digits. 각 자릿수의 곱과 합을 뺀 값을 반환한다. 예시 Example 1: Input: n = 234 Output: 15 Explanation: Product of digits = 2 * 3 * 4 = 24 Sum of digits = 2 + 3 + 4 = 9 Result = 24 - 9 = 15 Example 2: Input: n = 4421 Output: 21 Explanation: Product of digits = 4 * 4 * 2 * 1 = 32 Sum of digits = 4 + 4 + 2 + 1 = ..

[Easy] 1523. Count Odd Numbers in an Interval Range
leetCode 2022. 5. 26. 11:42

문제 Given two non-negative integers low and high. Return the count of odd numbers between low and high (inclusive). low부터 high까지 홀수가 몇 개인지 반환하는 문제이다. 예시 Example 1: Input: low = 3, high = 7 Output: 3 Explanation: The odd numbers between 3 and 7 are [3,5,7]. Example 2: Input: low = 8, high = 10 Output: 1 Explanation: The odd numbers between 8 and 10 are [9]. 제약 조건 Constraints: 0

[Easy] 231. Power of Two
leetCode 2022. 5. 24. 11:58

문제 Given an integer n, return true if it is a power of two. Otherwise, return false. An integer n is a power of two, if there exists an integer x such that n == 2x. 예시 Example 1: Input: n = 1 Output: true Explanation: 20 = 1 Example 2: Input: n = 16 Output: true Explanation: 24 = 16 Example 3: Input: n = 3 Output: false 제약조건 Constraints: -231

[Easy] 70. Climbing Stairs
leetCode 2022. 5. 23. 15:52

문제 You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? 예시 Example 1: Input: n = 2 Output: 2 Explanation: There are two ways to climb to the top. 1. 1 step + 1 step 2. 2 steps Example 2: Input: n = 3 Output: 3 Explanation: There are three ways to climb to the top. 1. 1 step + 1 step + 1 s..