File tree Expand file tree Collapse file tree 5 files changed +92
-0
lines changed Expand file tree Collapse file tree 5 files changed +92
-0
lines changed Original file line number Diff line number Diff line change 1+ name : CI
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ pull_request :
7+ branches : [ main ]
8+
9+ jobs :
10+ build :
11+ runs-on : ubuntu-latest
12+
13+ steps :
14+ - uses : actions/checkout@v3
15+
16+ - name : Set up JDK 17
17+ uses : actions/setup-java@v3
18+ with :
19+ java-version : ' 17'
20+ distribution : ' temurin'
21+ cache : maven
22+
23+ - name : Validate Java files
24+ run : |
25+ for file in $(find . -name "Solution.java"); do
26+ echo "Compiling $file"
27+ javac "$file"
28+ done
29+
30+ - name : Check README files exist
31+ run : |
32+ for dir in */; do
33+ if [ -d "$dir" ] && [ "$dir" != ".git/" ] && [ "$dir" != ".github/" ]; then
34+ if [ ! -f "${dir}README.md" ]; then
35+ echo "Missing README.md in ${dir}"
36+ exit 1
37+ fi
38+ if [ ! -f "${dir}Solution.java" ]; then
39+ echo "Missing Solution.java in ${dir}"
40+ exit 1
41+ fi
42+ fi
43+ done
44+
45+ - name : Validate markdown files
46+ uses : DavidAnson/markdownlint-cli2-action@v11
47+ with :
48+ globs : " **/*.md"
Original file line number Diff line number Diff line change 1+ # Markdown linting rules
2+ default : true
3+ MD013 : false # Line length
4+ MD033 : false # Allow inline HTML
5+ MD041 : false # First line in file should be a top level heading
Original file line number Diff line number Diff line change 11# Solving LeetCode Problems
22
3+ [ ![ CI] ( https://github.com/thanthtooaung-coding/Solving-LeetCode-Problems/actions/workflows/ci.yml/badge.svg )] ( https://github.com/thanthtooaung-coding/Solving-LeetCode-Problems/actions/workflows/ci.yml )
34[ ![ LeetCode Profile] ( https://img.shields.io/badge/LeetCode-Vinnn__96-FFA116?style=for-the-badge&logo=leetcode&logoColor=black )] ( https://leetcode.com/u/Vinnn_96/ )
45
56This repository contains my solutions to various LeetCode problems. Each solution is implemented in Java and includes detailed explanations.
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
3+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
5+ <modelVersion >4.0.0</modelVersion >
6+
7+ <groupId >com.leetcode.solutions</groupId >
8+ <artifactId >leetcode-solutions</artifactId >
9+ <version >1.0-SNAPSHOT</version >
10+
11+ <properties >
12+ <maven .compiler.source>17</maven .compiler.source>
13+ <maven .compiler.target>17</maven .compiler.target>
14+ <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
15+ </properties >
16+
17+ <dependencies >
18+ <dependency >
19+ <groupId >junit</groupId >
20+ <artifactId >junit</artifactId >
21+ <version >4.13.2</version >
22+ <scope >test</scope >
23+ </dependency >
24+ </dependencies >
25+ </project >
Original file line number Diff line number Diff line change 1+ import org .junit .Test ;
2+ import static org .junit .Assert .*;
3+
4+ public class SolutionTest {
5+ @ Test
6+ public void testTwoSum () {
7+ Solution solution = new Solution ();
8+ int [] nums = {2 , 7 , 11 , 15 };
9+ int target = 9 ;
10+ int [] result = solution .twoSum (nums , target );
11+ assertArrayEquals (new int []{0 , 1 }, result );
12+ }
13+ }
You can’t perform that action at this time.
0 commit comments