Skip to content

This repository contains the codes, I have been submitting in the 30 Days of Code program by Hackerrank.

License

Notifications You must be signed in to change notification settings

AdityaSeth777/30-Days-of-Code-Hackerrank

Repository files navigation

This repository contains the codes, I have been submitting in the 30 Days of Code program by Hackerrank.

I have mainly included the codes in the languages I know and am comfortable in. The languages are mainly -> C, C++, Python, Ruby and Kotlin. I am currently solving this event. Source code of the programs solved so far have been uploaded. I will upload the remaining programs as and when I solve. Descriptions and logic of individual programs will be uploaded soon.

1. How to install and run C/C++ ?

Installation ->

  1. Create a C/C++ virtual environment.
  2. Clone the repo git clone https://github.com/AdityaSeth777/30-Days-of-Code-Hackerrank.git or download the repository.
  3. Go to the cloned/downloaded directory, and navigate to your desired program -> cd "folder_name", and then to the code file.
  4. Run pip3 install gcc.
  5. And now you can run the example scripts or create your own scripts.

Usage ->

  • To run any program (without <math.h>), run gcc filename.c -o name, where filename is the name of the file you are wanting to execute; name = output executable file.

  • Then type ./name, and then press Enter to execute successfully.

  • To run any program (with <math.h>), run gcc filename.c -lm, where filename is the name of the file you are wanting to execute.

  • Then type ./a.out, and then press Enter to execute successfully.

2. How to install and run python ?

Installation ->

  1. Create a python virtual environment.
  2. Clone the repo git clone https://github.com/AdityaSeth777/30-Days-of-Code-Hackerrank.git or download the repository.
  3. Go to the cloned/downloaded directory, and navigate to your desired program -> cd "folder_name", and then to the code file.
  4. Go to the Python website.
  5. Download the software.
  6. Install it according to the guide.
  7. Open terminal and type python --version to see whether it is properly installed or not.
  8. And now you can run the example scripts or create your own scripts.

Usage ->

  • To run any python program, run python filename.py, where filename is the name of the file you are wanting to execute.
  • If the above command doesn't work, then run python3 filename.py, where again filename is the name of the file you are wanting to execute.

3. How to install and run Kotlin (basic codes like these) ?

Installation ->

  1. Create a Kotlin virtual environment.
  2. Clone the repo git clone https://github.com/AdityaSeth777/30-Days-of-Code-Hackerrank.git or download the repository.
  3. Go to the cloned/downloaded directory, and navigate to your desired program -> cd "folder_name", and then to the code file.
  4. An easier way to install Kotlin on UNIX-based systems, such as macOS, Linux, Cygwin, FreeBSD, and Solaris, is SDKMAN!. It also works in Bash and ZSH shells. To install the Kotlin compiler via SDKMAN!, run the following command in the terminal: sdk install kotlin.
  5. Alternatively, if you use Snap on Ubuntu, then sudo snap install --classic kotlin is a great method.
  6. And now you can run the example scripts or create your own scripts.

Usage ->

  • To run any Kotlin program, run kotlinc filename.kt -include-runtime -d out.jar, where filename is the name of the file you are wanting to execute ; out = output executable file.
  • Then run, java -jar hello.jar.

4. How to install and run Ruby ?

Installation ->

  1. Create a Ruby virtual environment.
  2. Clone the repo git clone https://github.com/AdityaSeth777/30-Days-of-Code-Hackerrank.git or download the repository.
  3. Go to the cloned/downloaded directory, and navigate to your desired program -> cd "folder_name", and then to the code file.
  4. Go to the installer website, which will give us some ease in installing Ruby. Notice that the list of options has “with Devkit” and “without Devkit” sections. The Devkit versions install the MSYS2 system, which will be required if you need to install RubyGems that require compilation. If you’re just going to play around with plain old Ruby, you might be able to get away with the non-Devkit version
  5. And if you have Ubuntu (Linux), then run the following commands ->
    • sudo apt-get update
    • sudo apt install ruby-full
    • Once the installation is complete, verify it by running this : ruby --version.

Usage ->

  • To run any Ruby program, run ruby your_program.rb.
  • Else if this throws any problem, then :
    • start your program with #!/usr/bin/env ruby.
    • make your file executable by running chmod +x your_program.rb.
    • Run ./your_program.rb some_param.

FAQ

  • How to stop the script? Ctrl+C (control+C for Mac)
  • For any other problems, feel free to raise an issue.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT License © Aditya Seth

What next ?

  • I will be working on completing this wonderful bunch of programs by Hackerrank, which I will be uploading as well.
  • Along with that, I will be uploading other programs as well including my college assignments and other projects.

Where to contact ?

Contact: [adityaseth.cse@gmail.com]

🙋‍♂️ Support

💙 If you like this project, give it a ⭐ and share it with friends!

☕ Buy me a coffee


Made with ❤️ and C, C++, Python, Ruby, and Kotlin.

About

This repository contains the codes, I have been submitting in the 30 Days of Code program by Hackerrank.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published