kk
This commit is contained in:
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
@@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
15
.idea/git_toolbox_prj.xml
generated
Normal file
15
.idea/git_toolbox_prj.xml
generated
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GitToolBoxProjectSettings">
|
||||
<option name="commitMessageIssueKeyValidationOverride">
|
||||
<BoolValueOverride>
|
||||
<option name="enabled" value="true" />
|
||||
</BoolValueOverride>
|
||||
</option>
|
||||
<option name="commitMessageValidationEnabledOverride">
|
||||
<BoolValueOverride>
|
||||
<option name="enabled" value="true" />
|
||||
</BoolValueOverride>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
@@ -1,5 +1,9 @@
|
||||
package com.dota;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
// 按两次 Shift 打开“随处搜索”对话框并输入 `show whitespaces`,
|
||||
// 然后按 Enter 键。现在,您可以在代码中看到空格字符。
|
||||
public class Main {
|
||||
@@ -17,3 +21,12 @@ public class Main {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Solution1 {
|
||||
public List<List<Integer>> permuteUnique(int[] nums) {
|
||||
Arrays.sort(nums);
|
||||
List<List<Integer>> res = new ArrayList<>();
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
@@ -35,6 +35,7 @@ public class Solution {
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
private boolean ok(int n) {
|
||||
if (n == 0) {
|
||||
return false;
|
||||
|
24
src/main/java/com/dota/arr/_2225/Solution.java
Normal file
24
src/main/java/com/dota/arr/_2225/Solution.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.dota.arr._2225;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
//2225. 找出输掉零场或一场比赛的玩家
|
||||
class Solution {
|
||||
public List<List<Integer>> findWinners(int[][] matches) {
|
||||
List<List<Integer>> res = new ArrayList<List<Integer>>();
|
||||
res.add(new ArrayList<>());
|
||||
res.add(new ArrayList<>());
|
||||
int[] book = new int[10001];
|
||||
for (int[] match : matches) {
|
||||
book[match[1]]++;
|
||||
}
|
||||
for (int i = 0; i < book.length; i++) {
|
||||
if (book[i] == 1) {
|
||||
res.get(1).add(i);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
41
src/main/java/com/dota/bucket/Solution.java
Normal file
41
src/main/java/com/dota/bucket/Solution.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.dota.bucket;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
class Solution {
|
||||
public boolean containsNearbyAlmostDuplicate(int[] nums, int k, int t) {
|
||||
Map<Long, Long> map = new HashMap<>();
|
||||
for (int i = 0; i < nums.length; i++) {
|
||||
long id = getId(nums[i], t + 1);
|
||||
if (map.containsKey(id)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
map.put(id, (long) nums[i]);
|
||||
|
||||
if (map.containsKey(id + 1) && Math.abs(map.get(id + 1) - nums[i]) <= t) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (map.containsKey(id - 1) && Math.abs(map.get(id - 1) - nums[i]) <= t) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (i >= k) {
|
||||
map.remove(getId(nums[i - k], t + 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public long getId(int x, int w) {
|
||||
if (x >= 0) {
|
||||
return x / w;
|
||||
}
|
||||
|
||||
return (x + 1) / w - 1;
|
||||
}
|
||||
}
|
@@ -5,6 +5,19 @@ package com.dota.map;
|
||||
*/
|
||||
class Solution {
|
||||
|
||||
public int maxDistance(int[] colors) {
|
||||
int max = 0;
|
||||
for (int i = 0; i < colors.length; i++) {
|
||||
for (int j = i+1; j < colors.length; j++) {
|
||||
if (colors[i] != colors[j]) {
|
||||
max = Math.max(max, j-i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return max;
|
||||
}
|
||||
|
||||
public String repeatLimitedString(String s, int repeatLimit) {
|
||||
var dp = new int[26];
|
||||
for (char c : s.toCharArray()) {
|
||||
|
3
src/main/kotlin/A.kt
Normal file
3
src/main/kotlin/A.kt
Normal file
@@ -0,0 +1,3 @@
|
||||
fun main() {
|
||||
println("123")
|
||||
}
|
Reference in New Issue
Block a user