摘要:本次记录一下数据可视化软件,可以通过这个可视化软件清楚地看到一些数据结构的操作过程,比如红黑树的插入,旋转,调整等操作。 url: https://www.cs.usfca.edu/~galles/visualization/Algorithms.html
阅读全文
摘要:1,Triangle 1 int mininumTotal(vector<vector<int>>& triangle) { 2 for (int i = triangle.size() - 2; i >= 0; --i) { 3 for (int j = 0; j < i + 1; ++j) {
阅读全文
摘要:树的测试框架: 1 // leetcodeTree.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include <iostream> 6 #include <queue> 7 #include <stack> 8 #include <ve
阅读全文
摘要:1,Valid Parentheses 1 bool isVaild1(string& s) { // 直接列举,不易扩展 2 stack<char> stk; 3 for (int i = 0; i < s.length(); ++i) { 4 if (stk.empty()) 5 stk.pus
阅读全文
摘要:1,Vaild Palindrome 1 bool isPalindrome(string& s) { 2 transform(s.begin(), s.end(), s.begin(), tolower); // 把字符全部转换成小写 3 int left = 0; 4 int right = s
阅读全文
摘要:链表测试框架示例: 1 // leetcodeList.cpp : 定义控制台应用程序的入口点。vs2013 测试通过 2 // 3 4 #include "stdafx.h" 5 #include <Windows.h> 6 #include <iostream> 7 8 using namesp
阅读全文
摘要:1,removeDuplicates(I) 1 int removeDuplicatesI(vector<int>& nums){ // 重新组织数组,同 removeDuplicates2IV 2 int index = 0; 3 for(int i=0;i<nums.size();++i){ 4
阅读全文
摘要:题目参考教材:https://github.com/soulmachine/leetcode(leetcode-cpp.pdf)
阅读全文
摘要:50. Pow(x, n) (中等) 96. Unique Binary Search Trees(很快) 1 class Solution { 2 public: 3 int numTrees(int n) { 4 long ans=1; 5 for(int i=n+1;i<=2*n;i++) 6
阅读全文
摘要:2. Add Two Numbers(中等) /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL
阅读全文