Skip to content

Instantly share code, notes, and snippets.

@zeraf29
Created January 22, 2019 09:38
Show Gist options
  • Save zeraf29/c13202f2bc6b3cd52ff94ee2c493df6e to your computer and use it in GitHub Desktop.
Save zeraf29/c13202f2bc6b3cd52ff94ee2c493df6e to your computer and use it in GitHub Desktop.
getStringPoint.java
public class Kata {
public static String high(String s) {
String bitWords = "";
int bitWordsPoint = 0;
String[] words = s.split(" ");
int tempPoint = 0;
for(String word : words) {
tempPoint = getWordsPoint(word.toLowerCase());
if(bitWordsPoint <= tempPoint) {
bitWordsPoint = tempPoint;
bitWords = word.toLowerCase();
}
}
return bitWords;
}
private static int getWordsPoint(String word) {
int point = 0;
for(int i=0; i<word.length(); i++) {
point += (word.charAt(i)-96);
}
return point;
}
}
@zeraf29
Copy link
Author

zeraf29 commented Jan 22, 2019

Stream 사용법 고민해보기

@zeraf29
Copy link
Author

zeraf29 commented Jan 22, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment