Skip to content

Commit a30a076

Browse files
committed
Interview problems
1 parent afb7af0 commit a30a076

149 files changed

Lines changed: 74115 additions & 12 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
def letter_changes(your_text):
2-
i = 0
3-
str1 = ""
4-
while i < len(your_text):
5-
x = your_text[i]
6-
if x.isalpha():
7-
str1 = str1 + str(chr(ord(x) + 1))
1+
class A:
2+
lis = []
3+
def printNos(self,N):
4+
if N == 1:
5+
self.lis.append(1)
6+
print(1, end=' ')
87
else:
9-
str1 = str1 + x
10-
i += 1
11-
12-
return str1
8+
self.printNos(N - 1)
9+
self.lis.append(N)
10+
print(N, end=' ')
1311

1412

1513
# keep this function call here
16-
print(letter_changes(str(input('Enter Your Name : '))).strip())
14+
a = A()
15+
a.printNos(10)
16+
print()
17+
print(a.lis)
18+
print(*a.lis)

problems/RestAPIMovieSearch.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import requests
2+
import re
3+
4+
url = "https://jsonmock.hackerrank.com/api/movies"
5+
year = '2000'
6+
query = "harry*"
7+
querystring = {"Year": year, "page": "1"}
8+
9+
headers = {}
10+
11+
response = requests.request("GET", url, headers=headers, params=querystring)
12+
respJson = response.json()
13+
movies = []
14+
# print(resjs)
15+
totalPage = respJson['total_pages']
16+
movies += respJson['data']
17+
for i in range(2, totalPage + 1):
18+
querystring = {"Year": year, "page": i}
19+
response = requests.request("GET", url, headers=headers, params=querystring)
20+
respJson = response.json()
21+
movies += respJson['data']
22+
p = re.compile(query, re.IGNORECASE)
23+
yourMovies = []
24+
for movie in movies:
25+
# print(movie)
26+
if p.match(movie['Title']):
27+
temp = [movie['imdbID'], movie['Title']]
28+
yourMovies += [temp]
29+
30+
print(*yourMovies, sep="\n")
31+
# print(movies)
32+
# print(movies[0])
33+
'''
34+
chech https://www.slideshare.net/HammadAli89/presentations/2 & geeks4geeks
35+
for studying algorithm
36+
'''

problems/ReverseImage.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
def invertImage(image):
2+
temp = []
3+
for i in range(len(image)):
4+
temp += [image[i][::-1]]
5+
6+
return temp[::-1]
7+
8+
def main():
9+
image_rows = int(input().strip())
10+
image_columns = int(input().strip())
11+
12+
image = []
13+
14+
for _ in range(image_rows):
15+
image.append(list(map(int, input().rstrip().split())))
16+
print(image)
17+
result = invertImage(image)
18+
print(result)
19+
'''
20+
Sample Input
21+
3
22+
3
23+
1 2 3
24+
4 5 6
25+
7 8 9
26+
'''
27+
28+
29+
main()

venv/bin/chardetect

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/Users/yusuf/Documents/PycharmProjects/pythonBeginners/venv/bin/python
2+
# -*- coding: utf-8 -*-
3+
import re
4+
import sys
5+
6+
from chardet.cli.chardetect import main
7+
8+
if __name__ == '__main__':
9+
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
10+
sys.exit(main())
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pip
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
This packge contains a modified version of ca-bundle.crt:
2+
3+
ca-bundle.crt -- Bundle of CA Root Certificates
4+
5+
Certificate data from Mozilla as of: Thu Nov 3 19:04:19 2011#
6+
This is a bundle of X.509 certificates of public Certificate Authorities
7+
(CA). These were automatically extracted from Mozilla's root certificates
8+
file (certdata.txt). This file can be found in the mozilla source tree:
9+
http://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1#
10+
It contains the certificates in PEM format and therefore
11+
can be directly used with curl / libcurl / php_curl, or with
12+
an Apache+mod_ssl webserver for SSL client authentication.
13+
Just configure this file as the SSLCACertificateFile.#
14+
15+
***** BEGIN LICENSE BLOCK *****
16+
This Source Code Form is subject to the terms of the Mozilla Public License,
17+
v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain
18+
one at http://mozilla.org/MPL/2.0/.
19+
20+
***** END LICENSE BLOCK *****
21+
@(#) $RCSfile: certdata.txt,v $ $Revision: 1.80 $ $Date: 2011/11/03 15:11:58 $
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
Metadata-Version: 2.1
2+
Name: certifi
3+
Version: 2020.12.5
4+
Summary: Python package for providing Mozilla's CA Bundle.
5+
Home-page: https://certifiio.readthedocs.io/en/latest/
6+
Author: Kenneth Reitz
7+
Author-email: me@kennethreitz.com
8+
License: MPL-2.0
9+
Project-URL: Documentation, https://certifiio.readthedocs.io/en/latest/
10+
Project-URL: Source, https://github.com/certifi/python-certifi
11+
Platform: UNKNOWN
12+
Classifier: Development Status :: 5 - Production/Stable
13+
Classifier: Intended Audience :: Developers
14+
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
15+
Classifier: Natural Language :: English
16+
Classifier: Programming Language :: Python
17+
Classifier: Programming Language :: Python :: 3
18+
Classifier: Programming Language :: Python :: 3.3
19+
Classifier: Programming Language :: Python :: 3.4
20+
Classifier: Programming Language :: Python :: 3.5
21+
Classifier: Programming Language :: Python :: 3.6
22+
Classifier: Programming Language :: Python :: 3.7
23+
Classifier: Programming Language :: Python :: 3.8
24+
Classifier: Programming Language :: Python :: 3.9
25+
26+
Certifi: Python SSL Certificates
27+
================================
28+
29+
`Certifi`_ provides Mozilla's carefully curated collection of Root Certificates for
30+
validating the trustworthiness of SSL certificates while verifying the identity
31+
of TLS hosts. It has been extracted from the `Requests`_ project.
32+
33+
Installation
34+
------------
35+
36+
``certifi`` is available on PyPI. Simply install it with ``pip``::
37+
38+
$ pip install certifi
39+
40+
Usage
41+
-----
42+
43+
To reference the installed certificate authority (CA) bundle, you can use the
44+
built-in function::
45+
46+
>>> import certifi
47+
48+
>>> certifi.where()
49+
'/usr/local/lib/python3.7/site-packages/certifi/cacert.pem'
50+
51+
Or from the command line::
52+
53+
$ python -m certifi
54+
/usr/local/lib/python3.7/site-packages/certifi/cacert.pem
55+
56+
Enjoy!
57+
58+
1024-bit Root Certificates
59+
~~~~~~~~~~~~~~~~~~~~~~~~~~
60+
61+
Browsers and certificate authorities have concluded that 1024-bit keys are
62+
unacceptably weak for certificates, particularly root certificates. For this
63+
reason, Mozilla has removed any weak (i.e. 1024-bit key) certificate from its
64+
bundle, replacing it with an equivalent strong (i.e. 2048-bit or greater key)
65+
certificate from the same CA. Because Mozilla removed these certificates from
66+
its bundle, ``certifi`` removed them as well.
67+
68+
In previous versions, ``certifi`` provided the ``certifi.old_where()`` function
69+
to intentionally re-add the 1024-bit roots back into your bundle. This was not
70+
recommended in production and therefore was removed at the end of 2018.
71+
72+
.. _`Certifi`: https://certifiio.readthedocs.io/en/latest/
73+
.. _`Requests`: https://requests.readthedocs.io/en/master/
74+
75+
Addition/Removal of Certificates
76+
--------------------------------
77+
78+
Certifi does not support any addition/removal or other modification of the
79+
CA trust store content. This project is intended to provide a reliable and
80+
highly portable root of trust to python deployments. Look to upstream projects
81+
for methods to use alternate trust.
82+
83+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
certifi-2020.12.5.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
2+
certifi-2020.12.5.dist-info/LICENSE,sha256=anCkv2sBABbVmmS4rkrY3H9e8W8ftFPMLs13HFo0ETE,1048
3+
certifi-2020.12.5.dist-info/METADATA,sha256=SEw5GGHIeBwGwDJsIUaVfEQAc5Jqs_XofOfTX-_kCE0,2994
4+
certifi-2020.12.5.dist-info/RECORD,,
5+
certifi-2020.12.5.dist-info/WHEEL,sha256=ADKeyaGyKF5DwBNE0sRE5pvW-bSkFMJfBuhzZ3rceP4,110
6+
certifi-2020.12.5.dist-info/top_level.txt,sha256=KMu4vUCfsjLrkPbSNdgdekS-pVJzBAJFO__nI8NF6-U,8
7+
certifi/__init__.py,sha256=SsmdmFHjHCY4VLtqwpp9P_jsOcAuHj-5c5WqoEz-oFg,62
8+
certifi/__main__.py,sha256=xBBoj905TUWBLRGANOcf7oi6e-3dMP4cEoG9OyMs11g,243
9+
certifi/__pycache__/__init__.cpython-38.pyc,,
10+
certifi/__pycache__/__main__.cpython-38.pyc,,
11+
certifi/__pycache__/core.cpython-38.pyc,,
12+
certifi/cacert.pem,sha256=u3fxPT--yemLvyislQRrRBlsfY9Vq3cgBh6ZmRqCkZc,263774
13+
certifi/core.py,sha256=V0uyxKOYdz6ulDSusclrLmjbPgOXsD0BnEf0SQ7OnoE,2303
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Wheel-Version: 1.0
2+
Generator: bdist_wheel (0.35.1)
3+
Root-Is-Purelib: true
4+
Tag: py2-none-any
5+
Tag: py3-none-any
6+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
certifi

0 commit comments

Comments
 (0)