Skip to content

Commit

Permalink
reorganized folders
Browse files Browse the repository at this point in the history
  • Loading branch information
codeperfectplus committed Jul 29, 2020
1 parent bc3104e commit d2ec4ab
Show file tree
Hide file tree
Showing 16 changed files with 242 additions and 1 deletion.
129 changes: 128 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,129 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

aaasample.py
# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
28 changes: 28 additions & 0 deletions 1. solveMeFirst/solution.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Topic : Algorithms
* Subtopic : SolveMeFirst
* Language : c++
* Problem Statement : sum of the above two integers
* Url : https://www.hackerrank.com/challenges/solve-me-first/problem
*/

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

int solveMeFirst(int a, int b) {
// Hint: Type return a+b; below:
return a + b;
}

int main() {
int num1, num2;
int sum;
cin>>num1>>num2;
sum = solveMeFirst(num1,num2);
cout<<sum;
return 0;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'''
Topic : Algorithms
Subtopic : SolveMeFirst
Language : Python
Problem Statement : sum of the above two integers
Url : https://www.hackerrank.com/challenges/solve-me-first/problem
'''
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
84 changes: 84 additions & 0 deletions 2. simpleArraySum/solution.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
* Topic : Algorithms
* Subtopic : SimpleArraySum
* Language : Python
* Problem Statement : Print the sum of the array's elements as a single integer.
* Url : https://www.hackerrank.com/challenges/simple-array-sum/problem
*/

#include <bits/stdc++.h>
#include <numeric>

using namespace std;

vector<string> split_string(string);

/*
* Complete the simpleArraySum function below.
*/
int simpleArraySum(vector<int> ar) {
/*
* Write your code here.
*/
return accumulate(ar.begin(), ar.end(), 0);

}

int main()
{
ofstream fout(getenv("OUTPUT_PATH"));

int ar_count;
cin >> ar_count;
cin.ignore(numeric_limits<streamsize>::max(), '\n');

string ar_temp_temp;
getline(cin, ar_temp_temp);

vector<string> ar_temp = split_string(ar_temp_temp);

vector<int> ar(ar_count);

for (int ar_itr = 0; ar_itr < ar_count; ar_itr++) {
int ar_item = stoi(ar_temp[ar_itr]);

ar[ar_itr] = ar_item;
}

int result = simpleArraySum(ar);

fout << result << "\n";

fout.close();

return 0;
}

vector<string> split_string(string input_string) {
string::iterator new_end = unique(input_string.begin(), input_string.end(), [] (const char &x, const char &y) {
return x == y and x == ' ';
});

input_string.erase(new_end, input_string.end());

while (input_string[input_string.length() - 1] == ' ') {
input_string.pop_back();
}

vector<string> splits;
char delimiter = ' ';

size_t i = 0;
size_t pos = input_string.find(delimiter);

while (pos != string::npos) {
splits.push_back(input_string.substr(i, pos - i));

i = pos + 1;
pos = input_string.find(delimiter, i);
}

splits.push_back(input_string.substr(i, min(pos, input_string.length()) - i + 1));

return splits;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'''
Topic : Algorithms
Subtopic : SimpleArraySum
Language : Python
Problem Statement : Print the sum of the array's elements as a single integer.
Url : https://www.hackerrank.com/challenges/simple-array-sum/problem
'''
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit d2ec4ab

Please sign in to comment.