Skip to content

Commit ae1982e

Browse files
Merge pull request TheAlgorithms#106 from OskarEn/master
Create Abecedarian.java
2 parents 01f0361 + 3eddef9 commit ae1982e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Misc/Abecedarian.java

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//Oskar Enmalm 29/9/17
2+
//An Abecadrian is a word where each letter is in alphabetical order
3+
4+
class Abecedarian{
5+
6+
public static boolean isAbecedarian(String s){
7+
int index = s.length() - 1;
8+
9+
for(int i =0; i <index; i++){
10+
11+
if(s.charAt(i)<=s.charAt(i + 1)){} //Need to check if each letter for the whole word is less than the one before it
12+
13+
else{return false;}
14+
}
15+
}
16+
return true;
17+
}

0 commit comments

Comments
 (0)