Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3081e01

Browse files
remove old code
1 parent86673fa commit3081e01

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

‎HARD/src/hard/AlienDictionary.java‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,13 @@ public class AlienDictionary {
1212
* And all code on the Discuss board fail by this test case.*/
1313
publicstaticStringalienOrder(String[]words) {
1414
Set<String>orders =newHashSet();
15-
Set<Character>orderChar =newHashSet();
1615
for(inti =0;i <words.length-1;i++){
1716
for(intj =0;j <Math.min(words[i].length(),words[i+1].length());j++){
1817
if(words[i].charAt(j) !=words[i+1].charAt(j)){
1918
Stringorder ="" +words[i].charAt(j) +words[i+1].charAt(j);
2019
StringreverseOrder ="" +words[i+1].charAt(j) +words[i].charAt(j);
2120
if(!orders.contains(order)) {
22-
orders.add(order);
23-
orderChar.add(words[i].charAt(j));
24-
orderChar.add(words[i+1].charAt(j));
25-
}
21+
orders.add(order); }
2622
if(orders.contains(reverseOrder))return"";
2723
break;
2824
}
@@ -38,10 +34,6 @@ public static String alienOrder(String[] words) {
3834
}
3935
}
4036

41-
for(charc :appearedLetters){
42-
if(!orderChar.contains(c))return"";
43-
}
44-
4537
int[]indegree =newint[26];
4638
for(Stringorder :orders){
4739
indegree[order.charAt(1) -'a']++;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp