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.
- Create a
C/C++
virtual environment. - Clone the repo
git clone https://github.com/AdityaSeth777/30-Days-of-Code-Hackerrank.git
or download the repository. - Go to the cloned/downloaded directory, and navigate to your desired program ->
cd "folder_name"
, and then to the code file. - Run
pip3 install gcc
. - And now you can run the example scripts or create your own scripts.
-
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.
- Create a
python
virtual environment. - Clone the repo
git clone https://github.com/AdityaSeth777/30-Days-of-Code-Hackerrank.git
or download the repository. - Go to the cloned/downloaded directory, and navigate to your desired program ->
cd "folder_name"
, and then to the code file. - Go to the Python website.
- Download the software.
- Install it according to the guide.
- Open terminal and type
python --version
to see whether it is properly installed or not. - And now you can run the example scripts or create your own scripts.
- 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.
- Create a
Kotlin
virtual environment. - Clone the repo
git clone https://github.com/AdityaSeth777/30-Days-of-Code-Hackerrank.git
or download the repository. - Go to the cloned/downloaded directory, and navigate to your desired program ->
cd "folder_name"
, and then to the code file. - 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
. - Alternatively, if you use Snap on Ubuntu, then
sudo snap install --classic kotlin
is a great method. - And now you can run the example scripts or create your own scripts.
- 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
.
- Create a
Ruby
virtual environment. - Clone the repo
git clone https://github.com/AdityaSeth777/30-Days-of-Code-Hackerrank.git
or download the repository. - Go to the cloned/downloaded directory, and navigate to your desired program ->
cd "folder_name"
, and then to the code file. - 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
- 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
.
- 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
.
- start your program with
- How to stop the script? Ctrl+C (control+C for Mac)
- For any other problems, feel free to raise an issue.
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.
- 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.
Contact: [[email protected]]
💙 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.