class Solution { //98. O(N)
public:
bool isValidBST(TreeNode* root) {...
#include <vector> // 378. O(Nlog(R−L)) O(1)
using namespace std;
c...
#include <vector>
using namespace std;
class Solution{
public: // 41...
#include <vector> // 1011. O(N * Log(Sum(W))) O(1)
#include <numer...
在現代程式設計中,善用物件導的特性,可以解決很多不必要的判斷。接下來要來探討各種在物件導向的演化路上,會用到的重構。
今天先從簡單的開始。
1. 當父類職責太多...
class Solution{//5. Longest Palindromic Substring O(N^2) O(1)
public:
string...