이 카테고리에서는 단순히 수학적 공식 혹은 지식을 깊게 다루진 않는다. 프로그래밍과 연관 지어서 유용하게 사용할 수 있는 수학적 지식을 다룬다. 1 + 2 + 3 + ... + n 의 결과는 무엇일까? 고등학교 교과과정에서 해당 식의 결과를 구하는 방법을 배웠다. 각 숫자의 나열을 수열이라 하고, 어떠한 규칙이냐에 따라 등차 혹은 등비로 나뉘었다. 해당 식의 경우 각 수열의 차가 1인 등차수열의 합이다. 해당 식은 간단하게 시그마(Σ)라는 기호를 사용하여 표현하였고, 시그마에 나오는 식의 종류나 형태에 따라 공식이 존재했다. 공식의 도출과정과 어떠한 형태로 코드에 나타날 수 있는지 프로그래머의 입장으로 다시 한번 식을 살펴보자. 먼저 공식의 도출 과정이다. 1 + 2 + 3 + ... + n을 나눠서 생..
![](http://i1.daumcdn.net/thumb/C148x148.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/N6pmY/btrJBUPZMOI/zRqq5hXRvEi0FSRcNZMDkK/img.jpg)
Question Given a non-negative integer x, compute and return the square root of x. Since the return type is an integer, the decimal digits are truncated, and only the integer part of the result is returned. Note: You are not allowed to use any built-in exponent function or operator, such as pow(x, 0.5) or x ** 0.5. 음이 아닌 정수 x가 주어졌을 때, 제곱근 x를 구하여라. 다만 제곱근 x를 구할 때 소수점 아래수는 버린다. Note: 내장 함수를 사용하면 안 ..
![](http://i1.daumcdn.net/thumb/C148x148.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/AdiAC/btrJKZWNlha/ZKMQBX9BiG4oaCGB9vWyGk/img.jpg)
Question Implement pow(x, n), which calculates x raised to the power n (i.e., xn). x의 n승을 리턴하는 pow 함수를 구현하라. 제약사항 -100.0 < x < 100.0 -2^31 = 1; } } if (n < 0) { ans = (double)(1.0) / (double)(ans); } return ans; } }; // 해당 문제의 Discuss 참고 출처 : https://leetcode.com/explore/interview/card/top-interview-questions-medium/113/math/818/ Explore - LeetCode LeetCode Explore is the best place for everyone..
![](http://i1.daumcdn.net/thumb/C148x148.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/0ZozK/btrJGUaHDtG/OdkVI6xBcJCtvxCKqRFrYk/img.jpg)
Question Given a string columnTitle that represents the column title as appears in an Excel sheet, return its corresponding column number. Excel 시트에 나타나는 열 제목을 나타내는 문자열 columnTitle이 주어지면 해당 열 번호를 반환합니다. 제약사항 1 27 ~ 702, 총 676개 = 26²개 3자리 수 => 703 ~ 18278, 총 17576개 = 26³ 그렇다면 26개의 단위로 column number를 확인할 수 있을 것 같다. 예를 들어, a = 1 b = 2 c = 3 "ABC" 라면 'C' = 'C' - 'A' + 1 'B' = ('B' - 'A' + 1) * 26; '..
![](http://i1.daumcdn.net/thumb/C148x148.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/Drlcf/btrJKubrUQ5/9CIHQL9TGtQDIfnzE8Ql9K/img.jpg)
Question Write an algorithm to determine if a number n is happy. A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits. Repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are..
![](http://i1.daumcdn.net/thumb/C148x148.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/sk1QM/btrJK0Bfwcg/SkcugVYabqhCFwyYTUKyrK/img.jpg)
Question Given an integer n, return the number of trailing zeroes in n!. integer 변수 n이 주어졌을 때, n 팩토리얼의 traling zeros 숫자 개수를 리턴하라. trailing zero란 일의 자리수 부터 있는 0의 개수이다. 예를 들어, 12300 이면 trailing zero는 2이다. 다만 중간에 0이 나오는 것은 trailing zero는 아니다. 예를 들어, 1200300의 trailing zero는 2이다. Note that n! = n * (n - 1) * (n - 2) *... * 3 * 2 * 1. 제약사항 0
![](http://i1.daumcdn.net/thumb/C148x148.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/cf3hzH/btrJBUuO4vY/VQg7RuRtkEcc3ZTTy2tcjk/img.png)
reference : https://google.github.io/styleguide/ Google Style Guides Style guides for Google-originated open-source projects google.github.io 구글에서 제시하는 C/C++ 코드스타일(네이밍 룰)을 알아본다 1. Class/Struct Class의 이름은 Pascal Case를 사용한다. Class의 멤버함수 또한 Pascal Case를 사용한다 Class의 멤버함수안의 일반 변수들은 Snake Case를 사용한다. class MyClass { public: int CountFooErrors(const std::vector& foos) { int total_number_of_foo_errors =..
![](http://i1.daumcdn.net/thumb/C148x148.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/cxCJni/btrJrQFNzgW/kNKxKHyHNkuRdOC2X9sqBk/img.jpg)
Question Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input. 구간의 시작점과 끝점 정보가 담긴 배열들을 담고있는 배열이 주어졌을 때, 겹치는 구간을 모두 합쳐, 겹치는 구간이 없게 반환하라. 제약사항 1
- Total
- Today
- Yesterday
- LeetCode
- ProblemSolving
- Interview
- 리트코드
- algorithm
- 속초 맛집
- 자료구조
- Problem Solving
- 내돈내산
- 기술면접
- Medium
- C++
- PS
- 러스트 배우기
- 솔직후기
- 코딩인터뷰
- 속초
- DP
- 반드시 알아야 할 자료구조
- rust
- interview question
- coding interview
- 러스트
- 알고리즘
- Tree
- 러스트 기초
- 러스트 입문
- 트리
- 맛집
- 인터뷰
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |