본문 바로가기
728x90

전체 글163

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.
사이트 모음 보호되어 있는 글 입니다. 2021. 12. 30.
cpp 멤버 함수 안에서 자신과 동일한 클래스 객체 private 멤버 접근 밑에 코드를 보면 원래 temp.num은 private이라 바로 접근해서 값을 바꿀 수 없다 근데 저 코드를 컴파일해보면 오류가 안 난다!! 왜일까!?? class Sum { private: int num; public: void sum { // num이 private이지만 자신의 클래스와 동일한 멤버 함수에서는 num에 접근 가능!! Sum temp; temp.num = 3; } } 멤버 함수 안에서 자신과 동일한 클래스 객체를 생성했을 때, 그 클래스 객체는 자기 클래스의 멤버 함수에 있는 것처럼 자신의 private 멤버에 자유롭게 접근이 가능하다! 너무 신기함!! 🤭🤭 2021. 12. 30.
cpp 증감 연산자 오버로딩 (전위 연산자, 후위 연산자) 전위 연산자와 후위 연산자가 똑같이 "operator++() {}" "operator--() {}" 형태인데 어떻게 두 개를 구분할까?? 전위 연산자 후위 연산자 파라미터 void int (int 값의 의미는 없고 단지 전위, 후위를 구분하기 위함) 리턴값 객체 자체 임시 객체 속도 빠름 느림 (객체의 새로 만들어 return하기에 속도가 느림) | ✍️ 전위 연산자 예시 // void값을 받으면 전위 연산자임. Fixed& Fixed::operator++(void) { this->setRawBits(this->getRawBits() + 1); return *this; } Fixed& Fixed::operator--(void) { this->setRawBits(this->getRawBits() - 1);.. 2021. 12. 30.
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.
can통신을 활용한 자동차 검진 서비스 드라마나 영화를 보면 미국 사람들이 종종 자신의 차를 직접 수리하는 모습을 볼 수 있다 1. 단지 차 상태만 확인하러 수리점에 가기에는 금액이 너무 부담이 간다 2. 수리점이 먼 경우 가기 힘들다 여러 가지 이유들로 미국 사람들은 직접 자신의 차를 수리하는 것 같다 차에 대한 깊은 지식 없이도 자신의 차의 상태를 확인할 수 있으면 얼마나 좋을까? 이런 생각에서 can 통신을 활용한 자동차 검진 서비스를 만들어보면 어떨까 생각했다 생각해야 될 것 1. can 통신이 좋은 이유, 더 좋은 방법이 있는지 2. can 통신으로 자동차와 통신하는 법 3. can 통신으로 자동차의 어떤 정보를 가져올 수 있는지 4. 어떤 방식으로 사용자에게 자동차의 정보를 보여주는 게 좋을지 3월의 공모전을 목표로 이 프로젝트를 .. 2021. 12. 30.
728x90