Skip to content

viniciusferreira7/algorithm-challenge-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Algorithm CLI

Description

This CLI offers a selection of algorithms that you can list and execute directly from the terminal. Currently, the CLI supports the "Find the Happy Numbers" algorithm.

Installation

Make sure you have bun installed. Clone this repository and navigate to the project directory. Install the necessary dependencies (if any).

Usage

To install dependencies:

bun install

Run the commands as described above to list and execute algorithms directly from the terminal.

Commands

Start

Displays a list of all available algorithms.

bun start

Expected output:

Welcome to the algorithm CLI

Which you want to test? 

? Select a algorithm (Use arrow keys)
❯ Find the Happy Numbers
  Permutable Palindrome Verification
- Anagram Verification
- Subsequence Verification
- Prime Number Sequence

Run Algorithm:

Find the Happy Numbers

Selects find the Happy Numbers algorithm.

Welcome to the algorithm CLI

Which you want to test? 

? Select a algorithm (Use arrow keys)
❯ Find the Happy Numbers
  Permutable Palindrome Verification
- Anagram Verification
- Subsequence Verification
- Prime Number Sequence

Example

To list happy numbers up to 19:

? Select a package Find the Happy Numbers
✔ Executing!
? Enter a number 19

Expected output:

✔ The value provided is happy a number!

Numbers seen: 82,68,100

happy numbers between 1 and 19: 1,7,10,13,19

To list happy numbers up to 45:

? Select a package Find the Happy Numbers
✔ Executing!
? Enter a number 45

Expected output:

✖ The value provided is not a happy number!

Numbers seen: 41,17,50,25,29,85,89,145,42,20,4,16,37,58

happy numbers between 1 and 45: 1,7,10,13,19,23,28,31,32,44

To list happy numbers up to test:

? Select a package Find the Happy Numbers
✔ Executing!
? Enter a number test

Expected output:

✖ The value provided is not a valid option: test

Run Algorithm:

Permutable Palindrome Verification

Selects permutable Palindrome Verification.

Welcome t  the algorithm CLI

Which you want to test? 

? Select a algorithm
  Find the Happy Numbers
❯ Permutable Palindrome Verification
- Anagram Verification

Example

Verify if civic is a palindrome:

? Select a algorithm Permutable Palindrome Verification
✔ Executing!
? Enter a text civic

Expected output:

✔ It`s a palindrome: civic

Verify if hello is a palindrome:

algorithm run 2 hello

Expected output:

✖ This text is not palindrome: hello

Verify if 145 is a palindrome:

✖ Invalid parameter

Expected output:

❌ Invalid parameter

Run Algorithm:

Anagram Verification

Selects anagram Verification algorithm.

Welcome to the algorithm CLI

Which you want to test? 

? Select a algorithm
  Find the Happy Numbers
  Permutable Palindrome Verification
❯ Anagram Verification
- Subsequence Verification
- Prime Number Sequence

Example

Can form anagram listen and silent:

? Select a algorithm Anagram Verification
✔ Executing!
? Enter a first text silent
? Enter a second text listen

Expected output:

✔ Theses text are anagrams of each other.

Can form anagram @54- and 456:

? Select a algorithm Anagram Verification
✔ Executing!
? Enter a first text @54-
? Enter a second text 456

Expected output:

✖ Text contains special characters or numbers, which are not allowed.These text cannot be an anagram.

Can form anagram não PoSsô and noa ossop:

? Select a algorithm Anagram Verification
✔ Executing!
? Enter a first text não PoSsô
? Enter a second text noa ossop

Expected output:

✔ Theses text are anagrams of each other.

Subsequence Verification

Enter a number.

Welcome to the algorithm CLI

Which you want to test? 

? Select a algorithm
  Find the Happy Numbers
  Permutable Palindrome Verification
  Anagram Verification
❯ Subsequence Verification
- Prime Number Sequence

Example

abc can be a subsequence from ahbgdc:

? Select a algorithm Anagram Verification
✔ Executing!
? Enter a first text abc
? Enter a second text ahbgdc

Expected output:

"abc" can be a subsequence from "ahbgdc"

axc can be a subsequence from ahbgdc:

? Select a algorithm Anagram Verification
✔ Executing!
? Enter a first text axc
? Enter a second text ahbgdc

Expected output:

"axc" cannot be a subsequence from "ahbgdc"

acE can be a subsequence from abcde:

? Select a algorithm Anagram Verification
✔ Executing!
? Enter a first text acE
? Enter a second text abcde

Expected output:

"acE" cannot be a subsequence from "abcde"

Prime Number Sequence

Enter a number.

Welcome to the algorithm CLI

Which you want to test? 

? Select a algorithm
  Find the Happy Numbers
  Permutable Palindrome Verification
  Anagram Verification
  Subsequence Verification
❯ Prime Number Sequence

Example

30 is not a prime number:

? Select a algorithm Anagram Verification
✔ Executing!
? Enter a number 30.

Expected output:

✖ 30 is not a prime a number!

 The Prime numbers up to 30: 2,3,5,7,11,13,17,19,23,29 

 The sum of all prime numbers up to 30 is 129

37 is a prime number:

? Select a algorithm Anagram Verification
✔ Executing!
? Enter a number 37.

Expected output:

✔ 37 is a prime a number!

 The Prime numbers up to 37: 2,3,5,7,11,13,17,19,23,29,31,37 

 The sum of all prime numbers up to 37 is 197

120 is not a prime number:

? Select a algorithm Anagram Verification
✔ Executing!
? Enter a number 120.

Expected output:

✖ 120 is not a prime a number!

 The Prime numbers up to 120: 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113

 The sum of all prime numbers up to 120 is 1593

Available Algorithms

  • Find the Happy Numbers: Finds all happy numbers up to the specified number.
  • Permutable Palindrome Verification: can form a palindrome.
  • Anagram Verification: can form an anagram.
  • Subsequence Verification: is a sequence that can be derived from another sequence by removing some or no elements.
  • Prime Number Sequence: Prime numbers are numbers greater than 1 that can only be divided by 1 and themselves. In this challenge, you need to generate a sequence of prime numbers up to a given value.

About

algorithm-challenge-cli

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published