Mais conteúdo relacionado
Semelhante a Good programmer habits (20)
Good programmer habits
- 5. Find the number of unique word by letter combination
(`aab`, `aba`, `bba`, `baa`) = 2 unique words
Class FindUniqueWord { Class FindUniqueWord {
def alphabets = [‘a’, ‘b’, ‘c’, ‘d’, ‘e’, function getUniqueWords(String[] words) {
‘f’, ‘g’, ‘h’, ‘i’, ‘j’, ‘k’, ‘l’, ‘m’, ‘n’, List<String> unique = new
‘o’, ‘p’, ‘q’, ‘r’, ‘s’, ‘t’, ‘u’, ‘v’, ‘w’, ArrayList<String>();
‘x’, ‘y’, ‘z’]
for (i=0; i<words.length; i++) {
char[] c1 = words[i].toCharArray();
function getWeight(String word) {
Arrays.sort(c1);
int weight = 0;
if (!unique.contains(new String(c1)) {
for (i=0; i<word.length(); i++) {
unique.add(new String(c1));
for (j=0; j<alphabets.length(); j++) {
}
if (word.chartAt(i) == alphabets[j])
}
weight += j;
return unique.count();
}
}
}
}
return weight;
}
function getUniqueWords(String[] words) {
List<int> unique = new ArrayList<int>();
for (i=0; i<words.length; i++) {
int weight = this.getWeight(words[i]);
if (!unique.contains(weight)) {
unique.add(weight);
}
}
return unique.count();
}
}
- 9. The Point of being lazy is, you stop doing anything but think,
to find an easy way to solve.
More simple means less bug.
- 11. Gather all mighty equipment and weapon
while you can
I hope can win with just one click
- 14. Functional
Programming Paradigm Anonymous Function
Imperative
Dependency Injection
Object-Oriented
Logic Programming
Multi threading Inner Class
Inheritance Polymorphism
Abstraction Encapsulation
Programming Technique
Software Architecture Software Development
Design Pattern
Builder Event Driven Development
Singleton
Decorator
Observer Abstract Factory Domain Driven Development
Strategy
Adapter
MVC Service Oriented Architecture..?
- 16. The invisible one is impossible to noticed
Unless we understand our coding in design perspective