原创 [PAT]1119 Pre- and Post-order Traversals (30 分)(樣例1未過,運行時錯誤原因)

一、題目 Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined

原创 判斷一個數是不是質數(素數),3種方式介紹

原文鏈接:https://blog.csdn.net/afei__/article/details/80638460 本文參考博文判斷一個數是不是質數(素數),3種方式介紹,原文章解釋的已經很詳

原创 [PAT]1099 Build A Binary Search Tree (30 分)(只得22分的原因)

一、題目: A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left s

原创 std::vector::erase——vector遍歷刪除

在對vector中的元素進行遍歷刪除時遇到了一點問題,查博客發現博客上並不靠譜。在此記錄,共同進步。 vector循環遍歷正確代碼: for(vector<int>::iterator it=vec.begin(); it!=

原创 [leetcode]32. Longest Valid Parentheses

題目描述 Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed)