일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- solver
- path planning
- DynamicProgramming
- 정적라이브러리
- Hybrid A star
- self driving car
- PathPlanning
- Frenet Coordinate
- autonomous vehicle
- 수치최적화
- CUDA
- 공유라이브러리
- MDP
- Graph Neural Network
- 백준
- 경로생성
- 강화학습
- CPP
- GIT
- 동적라이브러리
- 선형대수
- Leetcode
- OSQP
- C++
- 소프티어
- Recursion
- GNN
- C
- Motion Planning
- Dubins Path
- Today
- Total
목록Leetcode (18)
Swimmer
Solution - Use Hash Table Time Complexity O(n) Space Complexity O(n) #include bool digitCount(char* pnum); int main() { char string[] = "030"; bool RetVal; RetVal = digitCount(string); return 0; } bool digitCount(char* pnum) { bool bRetVal = true; const int ASCIINumberInit = 48; int i = 0; int NumOfChar = 0; int arrHashTable[10] = { 0 }; while (pnum[NumOfChar] != '\0') { arrHashTable[pnum[NumOfC..
Solution Get Total Sum of alice and bob candis number Calculate how many candies should be exchanged, to get equal num each other. But this method Runtime too much, only Beats 7.14% in Leet Code. Topics (presented in LeetCode) Hash Table Binary Search Sorting int* fairCandySwap( int* aliceSizes, int aliceSizesSize, int* bobSizes, int bobSizesSize, int* returnSize) { int i = 0; int aliceCandyNum ..
Solution - Use Hash Map - Compare Counting Number of each Character (except 0 occurence character) #define NumOfLowerCaseEnglishLetter 26 #define ASCII_INIT_NUM_IDX 97 bool areOccurrencesEqual(char* s) { long int NumOfChar = 0; int RefNum = 0; int arr[NumOfLowerCaseEnglishLetter] = { 0 }; // consists of lowercase English letters bool RetVal = true; while (s[NumOfChar] != '\0') { ++arr[s[NumOfCha..
Solution 1 using Hash Map Intuition Declare Hash Map represents charactoer 'a' to 'z' (size 26) Increase Hash Map Index which is in Magazine Note Decrease Hash Map Index which is in ransom Note If one of value in Hash Map under 0, Return false (it means character of Magazine Note doesn't represent ransom Note) When you use index, use should consider ASCII number of 'a' at inital index (97) bool ..