Skip to content

Commit cb6543a

Browse files
change java to md
1 parent 9bd4514 commit cb6543a

File tree

7 files changed

+58
-91
lines changed

7 files changed

+58
-91
lines changed

best-time-to-buy-and-sell-stock/jonghoonpark.java renamed to best-time-to-buy-and-sell-stock/dev-jonghoonpark.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
/*
2-
* https://leetcode.com/problems/best-time-to-buy-and-sell-stock/
3-
* time complexity : O(n)
4-
* space complexity : O(1)
5-
* https://jonghoonpark.com/2024/02/20/leetcode-121
6-
*/
1+
- https://leetcode.com/problems/best-time-to-buy-and-sell-stock/
2+
- time complexity : O(n)
3+
- space complexity : O(1)
4+
- https://algorithm.jonghoonpark.com/2024/02/20/leetcode-121
75

8-
/*
6+
```java
97
class Solution {
108
public int maxProfit(int[] prices) {
119
int buyAt = 0;
@@ -22,4 +20,4 @@ public int maxProfit(int[] prices) {
2220
return profit;
2321
}
2422
}
25-
*/
23+
```
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
- https://leetcode.com/problems/contains-duplicate/
2+
- time complexity : O(n)
3+
- space complexity : O(n)
4+
- https://algorithm.jonghoonpark.com/2024/04/24/leetcode-217
5+
6+
```java
7+
import java.util.HashSet;
8+
import java.util.Set;
9+
10+
class Solution {
11+
public boolean containsDuplicate(int[] nums) {
12+
Set<Integer> numSet = new HashSet<>();
13+
for (int num : nums) {
14+
if (numSet.contains(num)) {
15+
return true;
16+
}
17+
numSet.add(num);
18+
}
19+
return false;
20+
}
21+
}
22+
```

contains-duplicate/jonghoonpark.java

Lines changed: 0 additions & 31 deletions
This file was deleted.

two-sum/jonghoonpark.java renamed to two-sum/dev-jonghoonpark.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
/*
2-
* https://leetcode.com/problems/two-sum/
3-
* time complexity : O(n)
4-
* space complexity : O(n)
5-
* https://jonghoonpark.com/2024/01/03/leetcode-1
6-
*/
1+
- https://leetcode.com/problems/two-sum/
2+
- time complexity : O(n)
3+
- space complexity : O(n)
4+
- https://algorithm.jonghoonpark.com/2024/01/03/leetcode-1
75

8-
/*
6+
```java
97
import java.util.HashMap;
108
import java.util.Map;
119

@@ -26,4 +24,4 @@ public int[] twoSum(int[] nums, int target) {
2624
return null;
2725
}
2826
}
29-
*/
27+
```

valid-anagram/dev-jonghoonpark.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
- https://leetcode.com/problems/valid-anagram/
2+
- time complexity : O(nlogn)
3+
- space complexity : O(n)
4+
- https://algorithm.jonghoonpark.com/2024/04/24/leetcode-242
5+
6+
```java
7+
import java.util.Arrays;
8+
9+
class Solution {
10+
public boolean isAnagram(String s, String t) {
11+
char[] temp1 = s.toCharArray();
12+
char[] temp2 = t.toCharArray();
13+
Arrays.sort(temp1);
14+
Arrays.sort(temp2);
15+
return Arrays.equals(temp1, temp2);
16+
}
17+
}
18+
```

valid-anagram/jonghoonpark.java

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
1-
/*
2-
* https://leetcode.com/problems/valid-palindrome/
3-
* time complexity : O(n)
4-
* space complexity : O(n)
5-
* https://jonghoonpark.com/2024/04/24/leetcode-125
6-
*/
7-
8-
/*
9-
10-
void main() {
11-
Solution solution = new Solution();
12-
System.out.println(solution.isPalindrome("A man, a plan, a canal: Panama")); // true
13-
System.out.println(solution.isPalindrome("race a car")); // false
14-
System.out.println(solution.isPalindrome(" ")); // true
15-
}
1+
- https://leetcode.com/problems/valid-palindrome/
2+
- time complexity : O(n)
3+
- space complexity : O(n)
4+
- https://algorithm.jonghoonpark.com/2024/04/24/leetcode-125
165

6+
```java
177
class Solution {
188
public boolean isPalindrome(String s) {
199
StringBuilder filtered = new StringBuilder();
@@ -35,5 +25,4 @@ public boolean isPalindrome(String s) {
3525
return true;
3626
}
3727
}
38-
39-
*/
28+
```

0 commit comments

Comments
 (0)