-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlgorithm.cpp
More file actions
160 lines (130 loc) · 3.07 KB
/
Algorithm.cpp
File metadata and controls
160 lines (130 loc) · 3.07 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
// Algorithm.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
//#include "PaperMoneyChange.h"
//#include "07-Reverse.h"
//#include "98-IsValidBST.h"
/*#include "06-ZConvert.h"*/
/*#include "05-LongestPalindrome.h"*/
//#include "StrFunc.h"
//#include "BinarySearch.h"
//#include "ListFunc.h"
//#include "MinCutPalindrome.h"
//#include "12-IntToRoman.h"
//#include "50-Pow.h"
//#include "14-longestCommonPrefix.h"
//#include "15-threeSum.h"
//
// #include "20-ValidSymbol.h"
//
//
// void func()
// {
// static int val;
// }
// int Add_n(int n)
// {
// static int i = 100;
// i += n;
// return i;
// }
// class A
// {
// public:
// A(void) { printf("constuctor A ]\n"); }
// protected:
// virtual ~A(void) { printf("Deconstructor A \n"); }
//
// private:
// int m_nval;
// };
#include <vector>
#include <iostream>
#include <algorithm>
//#include "math.h"
//#include "LRU.h"
/*#include "largestArea.h"*/
#include "10000-joinQuant.h"
#include "121-maxProfit.h"
#include "119-longestConsecutive.h"
#include <assert.h>
using namespace std;
// int ArrayChallenge(int arr[], int arrLength) {
//
// // code goes here
// vector<int> dp(arrLength, INT_MIN);
// int res = INT_MIN;
// for (auto i = 0; i < arrLength - 1; ++i)
// {
// dp[i] = INT_MIN;
// for (auto j = i + 1; j < arrLength; ++j)
// {
// dp[i] = max(dp[i], arr[j] - arr[i]);
//
// }
// cout << dp[i] << " ";
// res = max(res, dp[i]);
// }
// return res;
// }
int _tmain(int argc, _TCHAR* argv[])
{
//string str[] = { "A", "B", "A", "C", "A", "B" };
//string res = MathChallenge("4 - 2 = x");
// int arr[] = { 6, 3, 1, 4, 12, 4 };
SolutionMaxProfit s;
s.test();
//int arr[] = { 1,2,3,4,5,6,7,8,9,10 };
int arr[] = { 3,6,7,1,8,9 };
SolutionJoinQuant1 t;
int m = t.MinShipWithDays(arr,6, 4);
std::cout << m << std::endl;
/* int area = ArrayChallenge(arr, 6);*/
//string res = ArrayChallenge(str, 6);
// int arr[] = { 10,12,4,5,9 };
//int res = ArrayChallenge(arr, 5);
// string str = { "4 - 2 = x" };
// std::string res = MathChallenge(str);
//
// int nTest = Add_n(10);
// std::cout << nTest << std::endl;
// nTest = Add_n(10);
// std::cout << nTest << std::endl;
//
// char szTmp[56] = { 0 };
// strcat(szTmp, "helloworld");
//
// float flValue = 0;
//
// if (flValue > -1e-6 && flValue <= 1e-6)
// {
// std::cout << "Test" << std::endl;
// }
//StrFunc strf;
//std::cout << strf.myAtoi("2147483648") << std::endl;
//std::cout << strf.strstr_28("hello", "ll") << std::endl;
//cout << strf.strstr_KMP("abaabaabbabaaabaabbabaab", "abaabbabaab") << endl;
//
// SingleList List;
// List.TestSingleList();
//Solution solut;
///solut.TestMinCut();
// solut.TestIntToRoman();
// solut.TestRomanToInt();
// solut.TestSearch();
// LCP lcpTmp;
// lcpTmp.TestLCP();
// std::string str("ningbeifei");
// std::string strTest(str, 1, 5);
// cout << strTest << endl;
// CThreeSum thre;
// thre.TestThreeSum_0();
// C20Solution so;
// bool bRet = so.isValid("()[]{}");
// printf("%d\n", bRet);
//
Solution119 s119;
assert(s119.Test());
system("pause");
return 0;
}