일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 |
31 |
- leetcode
- React
- bit
- JSX
- server
- routes
- c++
- map
- Callback
- UE5
- Props
- DP
- count
- queue
- treenode
- route
- node.js
- 비트연산
- priority_queue
- BinaryTree
- nodeJS
- state
- component
- css
- Context
- array
- Navigation
- event
- MySQL
- axios
- Today
- Total
목록Programming (C++) (18)
우사미 코딩
- the ASCII values of all 26 uppercase alphabet characters are 65–90 A : 65, B : 66 ....... Z : 90 - the ASCII values of all 26 lowercase alphabet characters are 97–122 a : 97, b: 98 .... z: 122 string s = "Test"이고 대문자를 소문자로 변환해야 할 때 if(s[i] >= 65 && s[i] = 'A' && s[i]
queue는 FIFO (First In First Out) 로 먼저 들어온 데이터가 우선적으로 삭제하는 자료구조이지만 priority_queue는 삽입된 순서와 관련없이 우선순위가 높은 데이터를 삭제하는 자료구조이다 오름차순, 내림차순 queue를 사용해야 할 때가 있는데 이때 priority queue를 사용한다. priority_queue를 사용하려면 queue를 include 해야한다. #include 1. 값이 높은 숫자가 우선적으로 삭제되는 queue priority_queue lessQ; lessQ.push(3); lessQ.push(2); lessQ.push(1); lessQ.push(6); lessQ.push(8); lessQ.push(7); lessQ.pop(); // 8삭제 lessQ...
1. 코드 #include // std::cout #include // std::istringstream using namespace std; int main() { string words = "I have a dream"; istringstream in(words); int i = 0, n = words.size(); for (string s; in >> s; i++) { cout
10진수의 정수를 bit로 출력하기 위해서는 아래와 같이 bitset 클래스를 사용한다. #include - 코드 #include int main() { int n = 32; cout

leetcode에서 anagram이나 permutation string 관련 문제를 풀 때 자주 사용한다 [anagram] - anagram은 문자의 순서를 바꾸어 다른 단어나 문장을 만드는 것 - anagram문자를 구성하는 알파벳의 개수는 동일하나 배치를 다르게 한다 - "rac"은 "car"의 anagram이다 - "aab"는 "aba"의 anagram이다 [permutation in string - 순열] - 순서가 부여된 임의의 집합을 다른 순서로 뒤섞는 연산 - "abc"의 permutation - "abc", "acb", "bac", "bca", "cab", "cba" - n개의 char로 만들 수 있는 모든 string의 조합은 n!개이다 [string을 구성하는 char의 개수를 배열에 ..
1. int to string string str = "123"; int num = stoi(str); 2. string to int int num = 243; string str = to_string(num);
- 숫자로 이루어진 char에 - '0'을 붙이면 int로 변환할 수 있다 예제 vector cv = { '0', '1', '2', '3', '4', '5' }; vector iv = {}; // int vector for (auto i : cv) { iv.push_back(i - '0'); // char를 int로 변환하여 iv에 삽입 } for (auto i : iv) { cout