본문 바로가기
728x90
leetcode 221) Maximal Square LV. Medium 🧐 https://leetcode.com/problems/maximal-square/ Maximal Square - 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 문제 Given an m x n binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. Example 1: Input: matrix = [["1","0".. 2022. 1. 4.
leetcode 878) Nth Magical Number LV. Hard 🥵 https://leetcode.com/problems/nth-magical-number/ Nth Magical Number - 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 문제 A positive integer is magical if it is divisible by either a or b. Given the three integers n, a, and b, return the nth magical number. Since the ans.. 2022. 1. 3.
문제에서 왜 항상 1e9+7로 나눈 나머지를 구하라고 할까?(모듈러 연산) 알고리즘을 풀다가 정답이 너무 클 수도 있으니 1000000007(1e9+7)로 나눈 나머지를 return 하라고 나왔다 왜 굳이 1e9+7를 return 하라는 걸까? C/C++에서 수의 표현은 제한적이다 int(4 bytes) : -2147483648(-2^31) ~ 2147483647(2^31-1) -> 근삿값 : 2e9 long long(8 bytes) : -9.22337204e18(-2^63) ~ 9.22337204e18(2^63) -> 근삿값 : 9e18 21! 만 해도 long long 범위를 벗어남 -> 조합이나 가짓수를 세는 문제에서 쉽게 오버플로우가 난다! 큰 결과를 표현하는 데에는 많은 방법이 있지만, 굳이 변환을..? 문제 출제자는 큰 수를 표현하는 방법을 원하는 게 아니라 답을 도.. 2022. 1. 2.
leetcode 790) Domino and Tromino Tiling LV. Medium 🧐 https://leetcode.com/problems/domino-and-tromino-tiling/ Domino and Tromino Tiling - 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 문제 You have two types of tiles: a 2 x 1 domino shape and a tromino shape. You may rotate these shapes. Given an integer n, return the nu.. 2022. 1. 2.
leetcode 1217) Minimum Cost to Move Chips to The Same Position LV. Easy 😎 https://leetcode.com/problems/minimum-cost-to-move-chips-to-the-same-position/ Minimum Cost to Move Chips to The Same Position - 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 문제 We have n chips, where the position of the ith chip is position[i]. We need to move all the.. 2022. 1. 2.
LeetCode 476) Number Complement LV. Easy 😎 https://leetcode.com/problems/number-complement/ Number Complement - 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 문제 The complement of an integer is the integer you get when you flip all the 0's to 1's and all the 1's to 0's in its binary representation. For example, .. 2021. 12. 30.
부동 소수점과 고정 소수점 이진 기수법 10진수에서는 10^n에 해당하는 수가 될 때마다 자릿수가 올라감 2진수에서는 2^n에 해당하는 수가 될 때마다 자릿수가 올라감 10진수 2진수 2 10 4 100 8 1000 9 1001 10진수를 2진수로 바꾸는 방법(정수) 10진수가 1이 될 때까지 계속 2로 나눠가면서 나머지를 구하고, 밑에서부터 거꾸로 읽으면 된다 | ✍️ 35를 이진수로 변환하는 예시 35 / 2 = 17 ... 1 17 / 2 = 8 ... 1 8 / 2 = 4 ... 0 4 / 2 = 2 ... 0 2 / 2 = 1 ... 0 1 1이 나왔으니 밑에서부터 읽어주면 35(10) = 100011(2) 10진수를 2진수로 바꾸는 방법(실수) 정수부는 그냥 정수 변환하는 거랑 똑같이 하면 된다. 소수부가 문제인데, 소.. 2021. 12. 29.
728x90