Skip to content

Commit

Permalink
Merge pull request #279 from LokoInsanus/challenges/2-palindromos/dar…
Browse files Browse the repository at this point in the history
…t/lokoinsanus

Finalizando desafio 2
  • Loading branch information
MarlonHenq authored Oct 5, 2023
2 parents e1aecda + b9ccc87 commit a63cb0f
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
46 changes: 46 additions & 0 deletions challenges/2-palindromos/dart/lokoinsanus/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Submissão de Exercicio

**Exercicio:** 2 - Palindromos

**Nickname:** lokoinsanus

**Nível Técnico:** - Estudante

**Empresa:** - Nenhuma

**Twitter**: https://twitter.com/lokoinsanus

**Dificuldade de Resolução:** - Baixa

**Como rodar o desafio**:

É necessário ter o ambiente ter instalada a Dart SDK. Podendo seguir as orientações em https://dart.dev/get-dart

Para compilar o código use:
```bash
dart palindromos.dart arara
```

**Input/Args**:
- arara
- abacaxi
- AmA
- rADar

**Output**:

```
true
```

```
false
```

```
true
```

```
true
```
12 changes: 12 additions & 0 deletions challenges/2-palindromos/dart/lokoinsanus/palindromos.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
main(List<String> args) {
print(invert(args[0]));
}

invert(String word) {
List<String> inverse = [];
word = word.toUpperCase();
for (var i = word.length - 1; i >= 0; i--) {
inverse.add(word[i]);
}
return inverse.join('') == word ? true : false;
}

0 comments on commit a63cb0f

Please sign in to comment.