Skip to content

Welcome to the 3-Character Code Generation Challenge! This challenge tests your ability with string manipulation, random number generation, and boundary handling in JavaScript. Dive in and show your skills! 🌟

License

Notifications You must be signed in to change notification settings

JohnBashombe/Coding-Challenge-Generate-a-3-Letter-Code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ 3-Character Code Generation Challenge πŸš€

Welcome to the 3-Character Code Generation Challenge! This challenge tests your ability with string manipulation, random number generation, and boundary handling in JavaScript. Dive in and show your skills! 🌟


🎯 Objective 🎯

Given a string with a length between 3 and 100 inclusive, your task is to generate a unique 3-character code based on specific rules.


πŸ“œ Input πŸ“œ

  • A string s
    • Constraints: 3 ≀ |s| ≀ 100 after sanitization
    • Only alphanumeric characters (A-Z, a-z, 0-9) are considered. Spaces and special characters will be removed.

🏁 Output 🏁

  • A 3-character code representation of the string.

πŸ“ Rules πŸ“

  1. βœ… The first character of the code should always be the first character of the sanitized string.
  2. βœ… The second character of the code can be any character from the sanitized string, but its position in the string must be strictly greater than the position of the first character. In essence, it should be picked randomly from the 2nd character of the string up to the penultimate character.
  3. βœ… The third character of the code should also be picked randomly. However, its position in the sanitized string should come strictly after the position of the second character.

Keyword Highlights: randomly, position, string, sanitization


πŸ“– Example πŸ“–

Given string: challenge! Sanitized string: challenge

Possible outputs: cae, clg, cne, etc.


πŸ›  Implementation πŸ› 

The solution should be implemented in JavaScript. We're looking forward to seeing a solution that's robust and can handle a variety of edge cases. Flex your coding muscles! πŸ’ͺ


πŸ”§ Requirements πŸ”§

  • Node.js: Ensure you have Node.js installed on your machine.
  • npm: Node Package Manager should also be installed.

πŸš€ Running the Project πŸš€

To run the project, navigate to the project directory and execute the following command:

node src/challenge.js

πŸ–‹ Author πŸ–‹

Ntavigwa Bashombe - Feel free to connect, share feedback, or ask any questions. Your contributions and insights are always welcome!

🌐 Share your solutions, ask questions, and collaborate in this repository! Happy coding! πŸš€

About

Welcome to the 3-Character Code Generation Challenge! This challenge tests your ability with string manipulation, random number generation, and boundary handling in JavaScript. Dive in and show your skills! 🌟

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published