2021年2月18日
摘要:
bool IsPopOrder(const int* pPush, const int* pPop, int nLength) { if (pPush == nullptr || pPop == nullptr || nLength <= 0) return false; std::stack<in
阅读全文
posted @ 2021-02-18 14:21
Noora&w
阅读(53)
推荐(0)
摘要:
std::stack<int> m_data; std::stack<int> m_min; //辅助栈 template <typename T> void StackWithMin<T>::push(const T& value) { m_data.push(value); if (m_min.
阅读全文
posted @ 2021-02-18 10:37
Noora&w
阅读(54)
推荐(0)
2021年2月16日
摘要:
void PrintMatrixClockwise(int** arr, int columns, int rows) { if (arr == nullptr || columns <= 0 || rows <= 0) return; int start = 0; while (columns >
阅读全文
posted @ 2021-02-16 21:53
Noora&w
阅读(35)
推荐(0)
摘要:
void MirrorRecursively(BinaryTreeNode* pRoot) { if (pRoot == nullptr || (pRoot->m_pLeft == nullptr && pRoot->m_pRight == nullptr)) return; BinaryTreeN
阅读全文
posted @ 2021-02-16 21:03
Noora&w
阅读(49)
推荐(0)
摘要:
struct BinaryTreeNode { int m_nValue; BinaryTreeNode* m_pLeft; BinaryTreeNode* m_pRight; }; bool HasSubTree(BinaryTreeNode* pRoot1, BinaryTreeNode* pR
阅读全文
posted @ 2021-02-16 20:53
Noora&w
阅读(22)
推荐(0)
摘要:
void ReorderOldEven(int* arr, unsigned int length) { if (arr == nullptr || length == 0) return; int* pBegin = arr; int* pEnd = arr + length - 1; while
阅读全文
posted @ 2021-02-16 15:18
Noora&w
阅读(61)
推荐(0)
2021年2月8日
摘要:
struct ListNode { int nValue; ListNode* pNext; }; void DeleteListNode(ListNode* pHeadNode, ListNode* pDeleteNode) { if (!pHeadNode || !pDeleteNode) re
阅读全文
posted @ 2021-02-08 17:31
Noora&w
阅读(50)
推荐(0)
摘要:
注意:需考虑大数问题 方法一: void PrintFrom1ToMax(int n) { if (n <= 0) return; char* arrPrintStr = new char[n+1]; memset(arrPrintStr, '0', n); arrPrintStr[n] = '\0
阅读全文
posted @ 2021-02-08 15:32
Noora&w
阅读(93)
推荐(0)
2021年2月7日
摘要:
bool g_bInvalidInput = false; double power(double base, int exponent) { if (equal(base, 0.0) && exponent < 0) { g_bInvalidInput = true; return 0.0; }
阅读全文
posted @ 2021-02-07 17:45
Noora&w
阅读(41)
推荐(0)
摘要:
void AgeSort(int arrAges[], int nLength) { const int nAgeMax = 99; int arrTemp[nAgeMax+1]; for (int i = 0; i < nAgeMax; ++i) { arrTemp[i] = 0; } for (
阅读全文
posted @ 2021-02-07 15:03
Noora&w
阅读(78)
推荐(0)