File tree Expand file tree Collapse file tree 8 files changed +260
-4
lines changed Expand file tree Collapse file tree 8 files changed +260
-4
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Created by supercoderhawk on 2017/7/26.
3+ */
4+
Original file line number Diff line number Diff line change 1+ cmake_minimum_required (VERSION 3.7)
2+ project (C)
3+
4+ set (CMAKE_C_STANDARD 99)
5+
6+ set (SOURCE_FILES main.c 301-350/328-Odd-Even-Linked-List.c 201-250/233-Number-of-Digit-One.c 1-50/1-Two-Sum.c 1-50/2-Add-Two_Numbers.c 1-50/3-Longest-Substring-Without-Repeating-Characters.c 1-50/5.-Longest-Palindromic-Substring.c 1-50/7-Reverse -Integer.c 1-50/8-String -to-Integer-atoi.c 1-50/6-ZigZag-Conversion.c 1-50/9-Palindrome-Number.c headers/problem_301_350.h headers/problem_201_250.h 151-200/172.-Factorial-Trailing-Zeroes.c "201-250/224-Basic-Calculator .c" headers/problem_151_200.h 1-50/11.-Container-With-Most-Water.c)
7+ add_executable (C ${SOURCE_FILES} )
Original file line number Diff line number Diff line change 1+ /*
2+ * Created by supercoderhawk on 2017/7/26.
3+ */
4+
5+ #ifndef C_PROBLEM_151_200_H
6+ #define C_PROBLEM_151_200_H
7+
8+ #include "../main.h"
9+
10+ int trailingZeroes (int n );
11+ void testTrailingZeroes ();
12+ #endif //C_PROBLEM_151_200_H
Original file line number Diff line number Diff line change 22 * Created by supercoderhawk on 2017/7/23.
33 */
44
5- #ifndef C_PROBLEM1_50_H
6- #define C_PROBLEM1_50_H
5+ #ifndef C_PROBLEM_1_50_H
6+ #define C_PROBLEM_1_50_H
77
8- #endif //C_PROBLEM1_50_H
8+ #include "../main.h"
9+
10+ // problem 1
11+ int * twoSum (int * nums , int numsSize , int target );
12+ void testTwoSum ();
13+
14+ // problem 2
15+ struct ListNode * addTwoNumbers (struct ListNode * l1 , struct ListNode * l2 );
16+ void testAddTwoNumbers ();
17+
18+ // problem 3
19+ int lengthOfLongestSubstring (char * s );
20+ void testLengthOfLongestSubstring ();
21+
22+ // problem 5
23+ char * longestPalindrome (char * s );
24+ void testLongestPalindrome ();
25+
26+ // problem 6
27+ char * convert (char * s , int numRows );
28+ void testConvert ();
29+
30+ // problem 7
31+ int reverse (int x );
32+ void testReverse ();
33+
34+ // problem 8
35+ int myAtoi (char * str );
36+ void testMyAtoi ();
37+
38+ // problem 9
39+ bool isPalindrome (int x );
40+ void testIsPalindrome ();
41+
42+ // problem 11
43+ int maxArea (int * height , int heightSize );
44+ void testMaxArea ();
45+ #endif //C_PROBLEM_1_50_H
Original file line number Diff line number Diff line change 1+ /*
2+ * Created by supercoderhawk on 2017/7/25.
3+ */
4+
5+ #ifndef C_PROBLEM_201_250_H
6+ #define C_PROBLEM_201_250_H
7+
8+ #include "../main.h"
9+
10+ // problem 233
11+ int countDigitOne (int n );
12+ void testCountDigitOne ();
13+
14+ #endif //C_PROBLEM_201_250_H
Original file line number Diff line number Diff line change 1+ /*
2+ * Created by supercoderhawk on 2017/7/25.
3+ */
4+
5+ #ifndef C_PROBLEM_301_350_H
6+ #define C_PROBLEM_301_350_H
7+
8+ #include "../main.h"
9+
10+ // problem 328
11+ struct ListNode * oddEvenList (struct ListNode * head );
12+ void testOddEvenList ();
13+ #endif //C_PROBLEM_301_350_H
Original file line number Diff line number Diff line change 11//
2- // Created by xyb-C308 on 2017/7/19.
2+ // Created by supercoderhawk on 2017/7/19.
33//
4+ #include <stdio.h>
5+ #include <stdlib.h>
6+ #include "main.h"
7+ #include "headers/problem_1_50.h"
8+ #include "headers/problem_151_200.h"
9+ #include "headers/problem_201_250.h"
10+ #include "headers/problem_301_350.h"
411
12+ struct ListNode * createList (const int * vals , int count ) {
13+ struct ListNode * header = NULL , * tmp , * p = NULL ;
14+ for (int i = 0 ; i < count ; i ++ ) {
15+ tmp = (struct ListNode * ) malloc (sizeof (struct ListNode * ));
16+ tmp -> val = vals [i ];
17+ tmp -> next = NULL ;
18+ if (header == NULL ) {
19+ header = p = tmp ;
20+ } else {
21+ p -> next = tmp ;
22+ p = tmp ;
23+ }
24+ }
25+ return header ;
26+ }
27+
28+ void printList (struct ListNode * l ) {
29+ struct ListNode * p = l ;
30+ while (p != NULL ) {
31+ printf ("%d" , p -> val );
32+ p = p -> next ;
33+ if (p != NULL ) {
34+ printf ("->" );
35+ }
36+ }
37+ printf ("\n" );
38+ }
39+
40+ void test_1_50 () {
41+ // testTwoSum();
42+ // testAddTwoNumbers();
43+ // testLengthOfLongestSubstring();
44+ // testLongestPalindrome();
45+ // testConvert();
46+ // testReverse();
47+ // testMyAtoi();
48+ // testIsPalindrome();
49+ /// testConvert();
50+ testMaxArea ();
51+ }
52+
53+ void test_151_200 () {
54+ testTrailingZeroes ();
55+ }
56+
57+ void test_201_250 () {
58+ // testCountDigitOne();
59+ }
60+
61+ void test_301_350 () {
62+ // testOddEvenList();
63+ }
64+
65+ //
66+ int main (int argc , char * argv []) {
67+ test_1_50 ();
68+ // test_151_200();
69+ }
Original file line number Diff line number Diff line change 1+ # Created by .ignore support plugin (hsz.mobi)
2+ # ## Example user template template
3+ # ## Example user template
4+
5+ # IntelliJ project files
6+ .idea
7+ * .iml
8+ out
9+ gen ### Python template
10+ # Byte-compiled / optimized / DLL files
11+ __pycache__ /
12+ * .py [cod ]
13+ * $py.class
14+
15+ # C extensions
16+ * .so
17+
18+ # Distribution / packaging
19+ .Python
20+ env /
21+ build /
22+ develop-eggs /
23+ dist /
24+ downloads /
25+ eggs /
26+ .eggs /
27+ lib /
28+ lib64 /
29+ parts /
30+ sdist /
31+ var /
32+ wheels /
33+ * .egg-info /
34+ .installed.cfg
35+ * .egg
36+
37+ # PyInstaller
38+ # Usually these files are written by a python script from a template
39+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
40+ * .manifest
41+ * .spec
42+
43+ # Installer logs
44+ pip-log.txt
45+ pip-delete-this-directory.txt
46+
47+ # Unit test / coverage reports
48+ htmlcov /
49+ .tox /
50+ .coverage
51+ .coverage. *
52+ .cache
53+ nosetests.xml
54+ coverage.xml
55+ * ,cover
56+ .hypothesis /
57+
58+ # Translations
59+ * .mo
60+ * .pot
61+
62+ # Django stuff:
63+ * .log
64+ local_settings.py
65+
66+ # Flask stuff:
67+ instance /
68+ .webassets-cache
69+
70+ # Scrapy stuff:
71+ .scrapy
72+
73+ # Sphinx documentation
74+ docs /_build /
75+
76+ # PyBuilder
77+ target /
78+
79+ # Jupyter Notebook
80+ .ipynb_checkpoints
81+
82+ # pyenv
83+ .python-version
84+
85+ # celery beat schedule file
86+ celerybeat-schedule
87+
88+ # SageMath parsed files
89+ * .sage.py
90+
91+ # dotenv
92+ .env
93+
94+ # virtualenv
95+ .venv
96+ venv /
97+ ENV /
98+
99+ # Spyder project settings
100+ .spyderproject
101+
102+ # Rope project settings
103+ .ropeproject
104+
You can’t perform that action at this time.
0 commit comments