repo_name
stringclasses
1 value
pr_number
int64
4.12k
11.2k
pr_title
stringlengths
9
107
pr_description
stringlengths
107
5.48k
author
stringlengths
4
18
date_created
timestamp[ns, tz=UTC]
date_merged
timestamp[ns, tz=UTC]
previous_commit
stringlengths
40
40
pr_commit
stringlengths
40
40
query
stringlengths
118
5.52k
before_content
stringlengths
0
7.93M
after_content
stringlengths
0
7.93M
label
int64
-1
1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" Convert International System of Units (SI) and Binary prefixes """ from enum import Enum from typing import Union class SI_Unit(Enum): yotta = 24 zetta = 21 exa = 18 peta = 15 tera = 12 giga = 9 mega = 6 kilo = 3 hecto = 2 deca = 1 deci = -1 centi = -2 milli = -...
""" Convert International System of Units (SI) and Binary prefixes """ from enum import Enum from typing import Union class SI_Unit(Enum): yotta = 24 zetta = 21 exa = 18 peta = 15 tera = 12 giga = 9 mega = 6 kilo = 3 hecto = 2 deca = 1 deci = -1 centi = -2 milli = -...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
# Python code to demonstrate working of # extend(), extendleft(), rotate(), reverse() # importing "collections" for deque operations import collections # initializing deque de = collections.deque([1, 2, 3]) # using extend() to add numbers to right end # adds 4,5,6 to right end de.extend([4, 5, 6]) # printing modifi...
# Python code to demonstrate working of # extend(), extendleft(), rotate(), reverse() # importing "collections" for deque operations import collections # initializing deque de = collections.deque([1, 2, 3]) # using extend() to add numbers to right end # adds 4,5,6 to right end de.extend([4, 5, 6]) # printing modifi...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
#!/usr/bin/env python3 """ Build a simple bare-minimum quantum circuit that starts with a single qubit (by default, in state 0) and inverts it. Run the experiment 1000 times and print the total count of the states finally observed. Qiskit Docs: https://qiskit.org/documentation/getting_started.html """ import qiskit as...
#!/usr/bin/env python3 """ Build a simple bare-minimum quantum circuit that starts with a single qubit (by default, in state 0) and inverts it. Run the experiment 1000 times and print the total count of the states finally observed. Qiskit Docs: https://qiskit.org/documentation/getting_started.html """ import qiskit as...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" Sum of digits sequence Problem 551 Let a(0), a(1),... be an integer sequence defined by: a(0) = 1 for n >= 1, a(n) is the sum of the digits of all preceding terms The sequence starts with 1, 1, 2, 4, 8, ... You are given a(10^6) = 31054319. Find a(10^15) """ ks = [k for k in range(2, 20 + 1)] base = [...
""" Sum of digits sequence Problem 551 Let a(0), a(1),... be an integer sequence defined by: a(0) = 1 for n >= 1, a(n) is the sum of the digits of all preceding terms The sequence starts with 1, 1, 2, 4, 8, ... You are given a(10^6) = 31054319. Find a(10^15) """ ks = [k for k in range(2, 20 + 1)] base = [...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
# https://en.wikipedia.org/wiki/Tree_traversal class Node: """ A Node has data variable and pointers to its left and right nodes. """ def __init__(self, data): self.left = None self.right = None self.data = data def make_tree() -> Node: root = Node(1) root.left = Nod...
# https://en.wikipedia.org/wiki/Tree_traversal class Node: """ A Node has data variable and pointers to its left and right nodes. """ def __init__(self, data): self.left = None self.right = None self.data = data def make_tree() -> Node: root = Node(1) root.left = Nod...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" A Stack using a linked list like structure """ from typing import Any class Node: def __init__(self, data): self.data = data self.next = None def __str__(self): return f"{self.data}" class LinkedStack: """ Linked List Stack implementing push (to top), pop (from top) ...
""" A Stack using a linked list like structure """ from typing import Any class Node: def __init__(self, data): self.data = data self.next = None def __str__(self): return f"{self.data}" class LinkedStack: """ Linked List Stack implementing push (to top), pop (from top) ...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" Project Euler Problem 4: https://projecteuler.net/problem=4 Largest palindrome product A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the product of two 3-digit numbers. References: -...
""" Project Euler Problem 4: https://projecteuler.net/problem=4 Largest palindrome product A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the product of two 3-digit numbers. References: -...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
"""Uses Pythagoras theorem to calculate the distance between two points in space.""" import math class Point: def __init__(self, x, y, z): self.x = x self.y = y self.z = z def __repr__(self) -> str: return f"Point({self.x}, {self.y}, {self.z})" def distance(a: Point, b: Poi...
"""Uses Pythagoras theorem to calculate the distance between two points in space.""" import math class Point: def __init__(self, x, y, z): self.x = x self.y = y self.z = z def __repr__(self) -> str: return f"Point({self.x}, {self.y}, {self.z})" def distance(a: Point, b: Poi...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" Wiggle Sort. Given an unsorted array nums, reorder it such that nums[0] < nums[1] > nums[2] < nums[3].... For example: if input numbers = [3, 5, 2, 1, 6, 4] one possible Wiggle Sorted answer is [3, 5, 1, 6, 2, 4]. """ def wiggle_sort(nums: list) -> list: """ Python implementation of wiggle. Example: ...
""" Wiggle Sort. Given an unsorted array nums, reorder it such that nums[0] < nums[1] > nums[2] < nums[3].... For example: if input numbers = [3, 5, 2, 1, 6, 4] one possible Wiggle Sorted answer is [3, 5, 1, 6, 2, 4]. """ def wiggle_sort(nums: list) -> list: """ Python implementation of wiggle. Example: ...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
from __future__ import annotations import math from typing import List, Union class SegmentTree: def __init__(self, size: int) -> None: self.size = size # approximate the overall size of segment tree with given value self.segment_tree = [0 for i in range(0, 4 * size)] # create arr...
from __future__ import annotations import math from typing import List, Union class SegmentTree: def __init__(self, size: int) -> None: self.size = size # approximate the overall size of segment tree with given value self.segment_tree = [0 for i in range(0, 4 * size)] # create arr...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
# An OOP approach to representing and manipulating matrices class Matrix: """ Matrix object generated from a 2D array where each element is an array representing a row. Rows can contain type int or float. Common operations and information available. >>> rows = [ ... [1, 2, 3], ... ...
# An OOP approach to representing and manipulating matrices class Matrix: """ Matrix object generated from a 2D array where each element is an array representing a row. Rows can contain type int or float. Common operations and information available. >>> rows = [ ... [1, 2, 3], ... ...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" @author: MatteoRaso """ from math import pi, sqrt from random import uniform from statistics import mean from typing import Callable def pi_estimator(iterations: int): """ An implementation of the Monte Carlo method used to find pi. 1. Draw a 2x2 square centred at (0,0). 2. Inscribe a circle withi...
""" @author: MatteoRaso """ from math import pi, sqrt from random import uniform from statistics import mean from typing import Callable def pi_estimator(iterations: int): """ An implementation of the Monte Carlo method used to find pi. 1. Draw a 2x2 square centred at (0,0). 2. Inscribe a circle withi...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
#!/usr/bin/python """ Author: OMKAR PATHAK """ from typing import Set class Graph: def __init__(self) -> None: self.vertices = {} def print_graph(self) -> None: """ prints adjacency list representation of graaph >>> g = Graph() >>> g.print_graph() >>> g.add_e...
#!/usr/bin/python """ Author: OMKAR PATHAK """ from typing import Set class Graph: def __init__(self) -> None: self.vertices = {} def print_graph(self) -> None: """ prints adjacency list representation of graaph >>> g = Graph() >>> g.print_graph() >>> g.add_e...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" Problem 43: https://projecteuler.net/problem=43 The number, 1406357289, is a 0 to 9 pandigital number because it is made up of each of the digits 0 to 9 in some order, but it also has a rather interesting sub-string divisibility property. Let d1 be the 1st digit, d2 be the 2nd digit, and so on. In this way, we no...
""" Problem 43: https://projecteuler.net/problem=43 The number, 1406357289, is a 0 to 9 pandigital number because it is made up of each of the digits 0 to 9 in some order, but it also has a rather interesting sub-string divisibility property. Let d1 be the 1st digit, d2 be the 2nd digit, and so on. In this way, we no...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
from bisect import bisect_left from functools import total_ordering from heapq import merge from typing import List """ A pure Python implementation of the patience sort algorithm For more information: https://en.wikipedia.org/wiki/Patience_sorting This algorithm is based on the card game patience For doctests run ...
from bisect import bisect_left from functools import total_ordering from heapq import merge from typing import List """ A pure Python implementation of the patience sort algorithm For more information: https://en.wikipedia.org/wiki/Patience_sorting This algorithm is based on the card game patience For doctests run ...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" Project Euler Problem 207: https://projecteuler.net/problem=207 Problem Statement: For some positive integers k, there exists an integer partition of the form 4**t = 2**t + k, where 4**t, 2**t, and k are all positive integers and t is a real number. The first two such partitions are 4**1 = 2**1 + 2 and 4**1.58496...
""" Project Euler Problem 207: https://projecteuler.net/problem=207 Problem Statement: For some positive integers k, there exists an integer partition of the form 4**t = 2**t + k, where 4**t, 2**t, and k are all positive integers and t is a real number. The first two such partitions are 4**1 = 2**1 + 2 and 4**1.58496...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" python/black : True """ from __future__ import annotations def prime_factors(n: int) -> list[int]: """ Returns prime factors of n as a list. >>> prime_factors(0) [] >>> prime_factors(100) [2, 2, 5, 5] >>> prime_factors(2560) [2, 2, 2, 2, 2, 2, 2, 2, 2, 5] >>> prime_factors(10*...
""" python/black : True """ from __future__ import annotations def prime_factors(n: int) -> list[int]: """ Returns prime factors of n as a list. >>> prime_factors(0) [] >>> prime_factors(100) [2, 2, 5, 5] >>> prime_factors(2560) [2, 2, 2, 2, 2, 2, 2, 2, 2, 5] >>> prime_factors(10*...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
# Created by susmith98 from collections import Counter from timeit import timeit # Problem Description: # Check if characters of the given string can be rearranged to form a palindrome. # Counter is faster for long strings and non-Counter is faster for short strings. def can_string_be_rearranged_as_palindrome_count...
# Created by susmith98 from collections import Counter from timeit import timeit # Problem Description: # Check if characters of the given string can be rearranged to form a palindrome. # Counter is faster for long strings and non-Counter is faster for short strings. def can_string_be_rearranged_as_palindrome_count...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
"""Password generator allows you to generate a random password of length N.""" from random import choice, shuffle from string import ascii_letters, digits, punctuation def password_generator(length=8): """ >>> len(password_generator()) 8 >>> len(password_generator(length=16)) 16 >>> len(passwo...
"""Password generator allows you to generate a random password of length N.""" from random import choice, shuffle from string import ascii_letters, digits, punctuation def password_generator(length=8): """ >>> len(password_generator()) 8 >>> len(password_generator(length=16)) 16 >>> len(passwo...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" Round Robin is a scheduling algorithm. In Round Robin each process is assigned a fixed time slot in a cyclic way. https://en.wikipedia.org/wiki/Round-robin_scheduling """ from statistics import mean from typing import List def calculate_waiting_times(burst_times: List[int]) -> List[int]: """ Calculate the...
""" Round Robin is a scheduling algorithm. In Round Robin each process is assigned a fixed time slot in a cyclic way. https://en.wikipedia.org/wiki/Round-robin_scheduling """ from statistics import mean from typing import List def calculate_waiting_times(burst_times: List[int]) -> List[int]: """ Calculate the...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
# Created by sarathkaul on 12/11/19 import requests _NEWS_API = "https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey=" def fetch_bbc_news(bbc_news_api_key: str) -> None: # fetching a list of articles in json format bbc_news_page = requests.get(_NEWS_API + bbc_news_api_key).json() # each ar...
# Created by sarathkaul on 12/11/19 import requests _NEWS_API = "https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey=" def fetch_bbc_news(bbc_news_api_key: str) -> None: # fetching a list of articles in json format bbc_news_page = requests.get(_NEWS_API + bbc_news_api_key).json() # each ar...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
# https://en.wikipedia.org/wiki/Hill_climbing import math class SearchProblem: """ An interface to define search problems. The interface will be illustrated using the example of mathematical function. """ def __init__(self, x: int, y: int, step_size: int, function_to_optimize): """ ...
# https://en.wikipedia.org/wiki/Hill_climbing import math class SearchProblem: """ An interface to define search problems. The interface will be illustrated using the example of mathematical function. """ def __init__(self, x: int, y: int, step_size: int, function_to_optimize): """ ...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
#!/usr/bin/python """ Author: OMKAR PATHAK """ class Graph: def __init__(self): self.vertex = {} # for printing the Graph vertices def print_graph(self) -> None: print(self.vertex) for i in self.vertex: print(i, " -> ", " -> ".join([str(j) for j in self.vertex[i]])) ...
#!/usr/bin/python """ Author: OMKAR PATHAK """ class Graph: def __init__(self): self.vertex = {} # for printing the Graph vertices def print_graph(self) -> None: print(self.vertex) for i in self.vertex: print(i, " -> ", " -> ".join([str(j) for j in self.vertex[i]])) ...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
from sklearn.neural_network import MLPClassifier X = [[0.0, 0.0], [1.0, 1.0], [1.0, 0.0], [0.0, 1.0]] y = [0, 1, 0, 0] clf = MLPClassifier( solver="lbfgs", alpha=1e-5, hidden_layer_sizes=(5, 2), random_state=1 ) clf.fit(X, y) test = [[0.0, 0.0], [0.0, 1.0], [1.0, 1.0]] Y = clf.predict(test) def wrapper(Y): ...
from sklearn.neural_network import MLPClassifier X = [[0.0, 0.0], [1.0, 1.0], [1.0, 0.0], [0.0, 1.0]] y = [0, 1, 0, 0] clf = MLPClassifier( solver="lbfgs", alpha=1e-5, hidden_layer_sizes=(5, 2), random_state=1 ) clf.fit(X, y) test = [[0.0, 0.0], [0.0, 1.0], [1.0, 1.0]] Y = clf.predict(test) def wrapper(Y): ...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
def topologicalSort(graph): """ Kahn's Algorithm is used to find Topological ordering of Directed Acyclic Graph using BFS """ indegree = [0] * len(graph) queue = [] topo = [] cnt = 0 for key, values in graph.items(): for i in values: indegree[i] += 1 for i i...
def topologicalSort(graph): """ Kahn's Algorithm is used to find Topological ordering of Directed Acyclic Graph using BFS """ indegree = [0] * len(graph) queue = [] topo = [] cnt = 0 for key, values in graph.items(): for i in values: indegree[i] += 1 for i i...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" Modular Exponential. Modular exponentiation is a type of exponentiation performed over a modulus. For more explanation, please check https://en.wikipedia.org/wiki/Modular_exponentiation """ """Calculate Modular Exponential.""" def modular_exponential(base: int, power: int, mod: int): """ ...
""" Modular Exponential. Modular exponentiation is a type of exponentiation performed over a modulus. For more explanation, please check https://en.wikipedia.org/wiki/Modular_exponentiation """ """Calculate Modular Exponential.""" def modular_exponential(base: int, power: int, mod: int): """ ...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" Project Euler Problem 7: https://projecteuler.net/problem=7 10001st prime By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10001st prime number? References: - https://en.wikipedia.org/wiki/Prime_number """ import itertools import math def pri...
""" Project Euler Problem 7: https://projecteuler.net/problem=7 10001st prime By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10001st prime number? References: - https://en.wikipedia.org/wiki/Prime_number """ import itertools import math def pri...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" Project Euler Problem 1: https://projecteuler.net/problem=1 Multiples of 3 and 5 If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. """ def solution(n: int = 1000) -> int: ...
""" Project Euler Problem 1: https://projecteuler.net/problem=1 Multiples of 3 and 5 If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. """ def solution(n: int = 1000) -> int: ...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" Coin sums Problem 31: https://projecteuler.net/problem=31 In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation: 1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p). It is possible to make £2 in the following way: 1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p H...
""" Coin sums Problem 31: https://projecteuler.net/problem=31 In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation: 1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p). It is possible to make £2 in the following way: 1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p H...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: 3797, 797, 97, and 7. Similarly we can work from right to left: 3797, 379, 37, and 3. Find the sum of the only eleven primes that are both truncatable fr...
""" The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: 3797, 797, 97, and 7. Similarly we can work from right to left: 3797, 379, 37, and 3. Find the sum of the only eleven primes that are both truncatable fr...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" Project Euler Problem 188: https://projecteuler.net/problem=188 The hyperexponentiation of a number The hyperexponentiation or tetration of a number a by a positive integer b, denoted by a↑↑b or b^a, is recursively defined by: a↑↑1 = a, a↑↑(k+1) = a(a↑↑k). Thus we have e.g. 3↑↑2 = 3^3 = 27, hence 3↑↑3 = 3^27 = ...
""" Project Euler Problem 188: https://projecteuler.net/problem=188 The hyperexponentiation of a number The hyperexponentiation or tetration of a number a by a positive integer b, denoted by a↑↑b or b^a, is recursively defined by: a↑↑1 = a, a↑↑(k+1) = a(a↑↑k). Thus we have e.g. 3↑↑2 = 3^3 = 27, hence 3↑↑3 = 3^27 = ...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" Introspective Sort is hybrid sort (Quick Sort + Heap Sort + Insertion Sort) if the size of the list is under 16, use insertion sort https://en.wikipedia.org/wiki/Introsort """ import math def insertion_sort(array: list, start: int = 0, end: int = 0) -> list: """ >>> array = [4, 2, 6, 8, 1, 7, 8, 22, 14, 5...
""" Introspective Sort is hybrid sort (Quick Sort + Heap Sort + Insertion Sort) if the size of the list is under 16, use insertion sort https://en.wikipedia.org/wiki/Introsort """ import math def insertion_sort(array: list, start: int = 0, end: int = 0) -> list: """ >>> array = [4, 2, 6, 8, 1, 7, 8, 22, 14, 5...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" Chinese Remainder Theorem: GCD ( Greatest Common Divisor ) or HCF ( Highest Common Factor ) If GCD(a,b) = 1, then for any remainder ra modulo a and any remainder rb modulo b there exists integer n, such that n = ra (mod a) and n = ra(mod b). If n1 and n2 are two such integers, then n1=n2(mod ab) Algorithm : 1. ...
""" Chinese Remainder Theorem: GCD ( Greatest Common Divisor ) or HCF ( Highest Common Factor ) If GCD(a,b) = 1, then for any remainder ra modulo a and any remainder rb modulo b there exists integer n, such that n = ra (mod a) and n = ra(mod b). If n1 and n2 are two such integers, then n1=n2(mod ab) Algorithm : 1. ...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
def dencrypt(s: str, n: int = 13) -> str: """ https://en.wikipedia.org/wiki/ROT13 >>> msg = "My secret bank account number is 173-52946 so don't tell anyone!!" >>> s = dencrypt(msg) >>> s "Zl frperg onax nppbhag ahzore vf 173-52946 fb qba'g gryy nalbar!!" >>> dencrypt(s) == msg True ...
def dencrypt(s: str, n: int = 13) -> str: """ https://en.wikipedia.org/wiki/ROT13 >>> msg = "My secret bank account number is 173-52946 so don't tell anyone!!" >>> s = dencrypt(msg) >>> s "Zl frperg onax nppbhag ahzore vf 173-52946 fb qba'g gryy nalbar!!" >>> dencrypt(s) == msg True ...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
def max_difference(a: list[int]) -> tuple[int, int]: """ We are given an array A[1..n] of integers, n >= 1. We want to find a pair of indices (i, j) such that 1 <= i <= j <= n and A[j] - A[i] is as large as possible. Explanation: https://www.geeksforgeeks.org/maximum-difference-between-two-elem...
def max_difference(a: list[int]) -> tuple[int, int]: """ We are given an array A[1..n] of integers, n >= 1. We want to find a pair of indices (i, j) such that 1 <= i <= j <= n and A[j] - A[i] is as large as possible. Explanation: https://www.geeksforgeeks.org/maximum-difference-between-two-elem...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
import tensorflow as tf from random import shuffle from numpy import array def TFKMeansCluster(vectors, noofclusters): """ K-Means Clustering using TensorFlow. 'vectors' should be a n*k 2-D NumPy array, where n is the number of vectors of dimensionality k. 'noofclusters' should be an integer. ...
import tensorflow as tf from random import shuffle from numpy import array def TFKMeansCluster(vectors, noofclusters): """ K-Means Clustering using TensorFlow. 'vectors' should be a n*k 2-D NumPy array, where n is the number of vectors of dimensionality k. 'noofclusters' should be an integer. ...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" A Queue using a linked list like structure """ from typing import Any class Node: def __init__(self, data: Any) -> None: self.data = data self.next = None def __str__(self) -> str: return f"{self.data}" class LinkedQueue: """ >>> queue = LinkedQueue() >>> queue.is_em...
""" A Queue using a linked list like structure """ from typing import Any class Node: def __init__(self, data: Any) -> None: self.data = data self.next = None def __str__(self) -> str: return f"{self.data}" class LinkedQueue: """ >>> queue = LinkedQueue() >>> queue.is_em...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
#!/usr/bin/env python3 def climb_stairs(n: int) -> int: """ LeetCdoe No.70: Climbing Stairs Distinct ways to climb a n step staircase where each time you can either climb 1 or 2 steps. Args: n: number of steps of staircase Returns: Distinct ways to climb a n step staircase ...
#!/usr/bin/env python3 def climb_stairs(n: int) -> int: """ LeetCdoe No.70: Climbing Stairs Distinct ways to climb a n step staircase where each time you can either climb 1 or 2 steps. Args: n: number of steps of staircase Returns: Distinct ways to climb a n step staircase ...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" developed by: markmelnic original repo: https://github.com/markmelnic/Scoring-Algorithm Analyse data using a range based percentual proximity algorithm and calculate the linear maximum likelihood estimation. The basic principle is that all values supplied will be broken down to a range from 0 to 1 and each column'...
""" developed by: markmelnic original repo: https://github.com/markmelnic/Scoring-Algorithm Analyse data using a range based percentual proximity algorithm and calculate the linear maximum likelihood estimation. The basic principle is that all values supplied will be broken down to a range from 0 to 1 and each column'...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" == Krishnamurthy Number == It is also known as Peterson Number A Krishnamurthy Number is a number whose sum of the factorial of the digits equals to the original number itself. For example: 145 = 1! + 4! + 5! So, 145 is a Krishnamurthy Number """ def factorial(digit: int) -> int: """ >>> factorial(3...
""" == Krishnamurthy Number == It is also known as Peterson Number A Krishnamurthy Number is a number whose sum of the factorial of the digits equals to the original number itself. For example: 145 = 1! + 4! + 5! So, 145 is a Krishnamurthy Number """ def factorial(digit: int) -> int: """ >>> factorial(3...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
def decrypt(message: str) -> None: """ >>> decrypt('TMDETUX PMDVU') Decryption using Key #0: TMDETUX PMDVU Decryption using Key #1: SLCDSTW OLCUT Decryption using Key #2: RKBCRSV NKBTS Decryption using Key #3: QJABQRU MJASR Decryption using Key #4: PIZAPQT LIZRQ Decryption using Key #5: ...
def decrypt(message: str) -> None: """ >>> decrypt('TMDETUX PMDVU') Decryption using Key #0: TMDETUX PMDVU Decryption using Key #1: SLCDSTW OLCUT Decryption using Key #2: RKBCRSV NKBTS Decryption using Key #3: QJABQRU MJASR Decryption using Key #4: PIZAPQT LIZRQ Decryption using Key #5: ...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
# Check whether Graph is Bipartite or Not using DFS # A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # o...
# Check whether Graph is Bipartite or Not using DFS # A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # o...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" Slowsort is a sorting algorithm. It is of humorous nature and not useful. It's based on the principle of multiply and surrender, a tongue-in-cheek joke of divide and conquer. It was published in 1986 by Andrei Broder and Jorge Stolfi in their paper Pessimal Algorithms and Simplexity Analysis (a parody of optimal al...
""" Slowsort is a sorting algorithm. It is of humorous nature and not useful. It's based on the principle of multiply and surrender, a tongue-in-cheek joke of divide and conquer. It was published in 1986 by Andrei Broder and Jorge Stolfi in their paper Pessimal Algorithms and Simplexity Analysis (a parody of optimal al...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
def bubble_sort(list_data: list, length: int = 0) -> list: """ It is similar is bubble sort but recursive. :param list_data: mutable ordered sequence of elements :param length: length of list data :return: the same list in ascending order >>> bubble_sort([0, 5, 2, 3, 2], 5) [0, 2, 2, 3, 5] ...
def bubble_sort(list_data: list, length: int = 0) -> list: """ It is similar is bubble sort but recursive. :param list_data: mutable ordered sequence of elements :param length: length of list data :return: the same list in ascending order >>> bubble_sort([0, 5, 2, 3, 2], 5) [0, 2, 2, 3, 5] ...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" Problem 72 Counting fractions: https://projecteuler.net/problem=72 Description: Consider the fraction, n/d, where n and d are positive integers. If n<d and HCF(n,d)=1, it is called a reduced proper fraction. If we list the set of reduced proper fractions for d ≤ 8 in ascending order of size, we get: 1/8, 1/7, 1/6...
""" Problem 72 Counting fractions: https://projecteuler.net/problem=72 Description: Consider the fraction, n/d, where n and d are positive integers. If n<d and HCF(n,d)=1, it is called a reduced proper fraction. If we list the set of reduced proper fractions for d ≤ 8 in ascending order of size, we get: 1/8, 1/7, 1/6...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" Create a Long Short Term Memory (LSTM) network model An LSTM is a type of Recurrent Neural Network (RNN) as discussed at: * http://colah.github.io/posts/2015-08-Understanding-LSTMs * https://en.wikipedia.org/wiki/Long_short-term_memory """ import numpy as np import pandas as pd from keras.layers imp...
""" Create a Long Short Term Memory (LSTM) network model An LSTM is a type of Recurrent Neural Network (RNN) as discussed at: * http://colah.github.io/posts/2015-08-Understanding-LSTMs * https://en.wikipedia.org/wiki/Long_short-term_memory """ import numpy as np import pandas as pd from keras.layers imp...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
### Computer Vision Computer vision is a field of computer science that works on enabling computers to see, identify and process images in the same way that human vision does, and then provide appropriate output. It is like imparting human intelligence and instincts to a computer. Image processing and computer vision ...
### Computer Vision Computer vision is a field of computer science that works on enabling computers to see, identify and process images in the same way that human vision does, and then provide appropriate output. It is like imparting human intelligence and instincts to a computer. Image processing and computer vision ...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" Implements a disjoint set using Lists and some added heuristics for efficiency Union by Rank Heuristic and Path Compression """ class DisjointSet: def __init__(self, set_counts: list) -> None: """ Initialize with a list of the number of items in each set and with rank = 1 for each set ...
""" Implements a disjoint set using Lists and some added heuristics for efficiency Union by Rank Heuristic and Path Compression """ class DisjointSet: def __init__(self, set_counts: list) -> None: """ Initialize with a list of the number of items in each set and with rank = 1 for each set ...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
""" Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. Example: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0,...
""" Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. Example: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0,...
-1
TheAlgorithms/Python
4,317
fix(mypy): type annotations for linear algebra algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-05T11:42:12Z
2021-04-05T13:37:38Z
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
8c2986026bc42d81a6d9386c9fe621fea8ff2d15
fix(mypy): type annotations for linear algebra algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING....
def get_set_bits_count(number: int) -> int: """ Count the number of set bits in a 32 bit integer >>> get_set_bits_count(25) 3 >>> get_set_bits_count(37) 3 >>> get_set_bits_count(21) 3 >>> get_set_bits_count(58) 4 >>> get_set_bits_count(0) 0 >>> get_set_bits_count(256)...
def get_set_bits_count(number: int) -> int: """ Count the number of set bits in a 32 bit integer >>> get_set_bits_count(25) 3 >>> get_set_bits_count(37) 3 >>> get_set_bits_count(21) 3 >>> get_set_bits_count(58) 4 >>> get_set_bits_count(0) 0 >>> get_set_bits_count(256)...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
name: "build" on: pull_request: schedule: - cron: "0 0 * * *" # Run everyday jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: python-version: "3.9" - uses: actions/cache@v2 with: path: ~...
name: "build" on: pull_request: schedule: - cron: "0 0 * * *" # Run everyday jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: python-version: "3.9" - uses: actions/cache@v2 with: path: ~...
1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
""" The function below will convert any binary string to the octal equivalent. >>> bin_to_octal("1111") '17' >>> bin_to_octal("101010101010011") '52523' >>> bin_to_octal("") Traceback (most recent call last): ... ValueError: Empty string was passed to the function >>> bin_to_octal("a-1") Traceback (most recent call ...
""" The function below will convert any binary string to the octal equivalent. >>> bin_to_octal("1111") '17' >>> bin_to_octal("101010101010011") '52523' >>> bin_to_octal("") Traceback (most recent call last): ... ValueError: Empty string was passed to the function >>> bin_to_octal("a-1") Traceback (most recent call ...
1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
"""Convert a Decimal Number to a Binary Number.""" def decimal_to_binary(num: int) -> str: """ Convert an Integer Decimal Number to a Binary Number as str. >>> decimal_to_binary(0) '0b0' >>> decimal_to_binary(2) '0b10' >>> decimal_to_binary(7) '0b111' >>> decimal_to_binary(35) ...
"""Convert a Decimal Number to a Binary Number.""" def decimal_to_binary(num: int) -> str: """ Convert an Integer Decimal Number to a Binary Number as str. >>> decimal_to_binary(0) '0b0' >>> decimal_to_binary(2) '0b10' >>> decimal_to_binary(7) '0b111' >>> decimal_to_binary(35) ...
1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
""" Convert Base 10 (Decimal) Values to Hexadecimal Representations """ # set decimal value for each hexadecimal digit values = { 0: "0", 1: "1", 2: "2", 3: "3", 4: "4", 5: "5", 6: "6", 7: "7", 8: "8", 9: "9", 10: "a", 11: "b", 12: "c", 13: "d", 14: "e", ...
""" Convert Base 10 (Decimal) Values to Hexadecimal Representations """ # set decimal value for each hexadecimal digit values = { 0: "0", 1: "1", 2: "2", 3: "3", 4: "4", 5: "5", 6: "6", 7: "7", 8: "8", 9: "9", 10: "a", 11: "b", 12: "c", 13: "d", 14: "e", ...
1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
"""Convert a Decimal Number to an Octal Number.""" import math # Modified from: # https://github.com/TheAlgorithms/Javascript/blob/master/Conversions/DecimalToOctal.js def decimal_to_octal(num: int) -> str: """Convert a Decimal Number to an Octal Number. >>> all(decimal_to_octal(i) == oct(i) for i ... ...
"""Convert a Decimal Number to an Octal Number.""" import math # Modified from: # https://github.com/TheAlgorithms/Javascript/blob/master/Conversions/DecimalToOctal.js def decimal_to_octal(num: int) -> str: """Convert a Decimal Number to an Octal Number. >>> all(decimal_to_octal(i) == oct(i) for i ... ...
1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
""" Convert International System of Units (SI) and Binary prefixes """ from enum import Enum from typing import Union class SI_Unit(Enum): yotta = 24 zetta = 21 exa = 18 peta = 15 tera = 12 giga = 9 mega = 6 kilo = 3 hecto = 2 deca = 1 deci = -1 centi = -2 milli = -...
""" Convert International System of Units (SI) and Binary prefixes """ from enum import Enum from typing import Union class SI_Unit(Enum): yotta = 24 zetta = 21 exa = 18 peta = 15 tera = 12 giga = 9 mega = 6 kilo = 3 hecto = 2 deca = 1 deci = -1 centi = -2 milli = -...
1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
""" Conversion of weight units. __author__ = "Anubhav Solanki" __license__ = "MIT" __version__ = "1.0.0" __maintainer__ = "Anubhav Solanki" __email__ = "anubhavsolanki0@gmail.com" USAGE : -> Import this file into their respective project. -> Use the function weight_conversion() for conversion of weight units. -> Para...
""" Conversion of weight units. __author__ = "Anubhav Solanki" __license__ = "MIT" __version__ = "1.0.0" __maintainer__ = "Anubhav Solanki" __email__ = "anubhavsolanki0@gmail.com" USAGE : -> Import this file into their respective project. -> Use the function weight_conversion() for conversion of weight units. -> Para...
1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
""" Test cases: Do you want to enter your denominations ? (Y/N) :N Enter the change you want to make in Indian Currency: 987 Following is minimal change for 987 : 500 100 100 100 100 50 20 10 5 2 Do you want to enter your denominations ? (Y/N) :Y Enter number of denomination:10 1 5 10 20 50 100 200 500 1000 2000 Ente...
""" Test cases: Do you want to enter your denominations ? (Y/N) :N Enter the change you want to make in Indian Currency: 987 Following is minimal change for 987 : 500 100 100 100 100 50 20 10 5 2 Do you want to enter your denominations ? (Y/N) :Y Enter number of denomination:10 1 5 10 20 50 100 200 500 1000 2000 Ente...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
from math import log2 def binary_count_trailing_zeros(a: int) -> int: """ Take in 1 integer, return a number that is the number of trailing zeros in binary representation of that number. >>> binary_count_trailing_zeros(25) 0 >>> binary_count_trailing_zeros(36) 2 >>> binary_count_trail...
from math import log2 def binary_count_trailing_zeros(a: int) -> int: """ Take in 1 integer, return a number that is the number of trailing zeros in binary representation of that number. >>> binary_count_trailing_zeros(25) 0 >>> binary_count_trailing_zeros(36) 2 >>> binary_count_trail...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
#!/usr/bin/env python # # Sort large text files in a minimum amount of memory # import argparse import os class FileSplitter: BLOCK_FILENAME_FORMAT = "block_{0}.dat" def __init__(self, filename): self.filename = filename self.block_filenames = [] def write_block(self, data, block_number...
#!/usr/bin/env python # # Sort large text files in a minimum amount of memory # import argparse import os class FileSplitter: BLOCK_FILENAME_FORMAT = "block_{0}.dat" def __init__(self, filename): self.filename = filename self.block_filenames = [] def write_block(self, data, block_number...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
""" https://www.hackerrank.com/challenges/abbr/problem You can perform the following operation on some string, : 1. Capitalize zero or more of 's lowercase letters at some index i (i.e., make them uppercase). 2. Delete all of the remaining lowercase letters in . Example: a=daBcd and b="ABC" daBcd -> capitalize a a...
""" https://www.hackerrank.com/challenges/abbr/problem You can perform the following operation on some string, : 1. Capitalize zero or more of 's lowercase letters at some index i (i.e., make them uppercase). 2. Delete all of the remaining lowercase letters in . Example: a=daBcd and b="ABC" daBcd -> capitalize a a...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
""" Greatest Common Divisor. Wikipedia reference: https://en.wikipedia.org/wiki/Greatest_common_divisor gcd(a, b) = gcd(a, -b) = gcd(-a, b) = gcd(-a, -b) by definition of divisibility """ def greatest_common_divisor(a: int, b: int) -> int: """ Calculate Greatest Common Divisor (GCD). >>> greatest_common...
""" Greatest Common Divisor. Wikipedia reference: https://en.wikipedia.org/wiki/Greatest_common_divisor gcd(a, b) = gcd(a, -b) = gcd(-a, b) = gcd(-a, -b) by definition of divisibility """ def greatest_common_divisor(a: int, b: int) -> int: """ Calculate Greatest Common Divisor (GCD). >>> greatest_common...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
import math from typing import Callable, Union def line_length( fnc: Callable[[Union[int, float]], Union[int, float]], x_start: Union[int, float], x_end: Union[int, float], steps: int = 100, ) -> float: """ Approximates the arc length of a line segment by treating the curve as a sequence ...
import math from typing import Callable, Union def line_length( fnc: Callable[[Union[int, float]], Union[int, float]], x_start: Union[int, float], x_end: Union[int, float], steps: int = 100, ) -> float: """ Approximates the arc length of a line segment by treating the curve as a sequence ...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
from typing import Any class Node: def __init__(self, data: Any): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None def print_list(self): temp = self.head while temp is not None: print(temp.data, end=" ") ...
from typing import Any class Node: def __init__(self, data: Any): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None def print_list(self): temp = self.head while temp is not None: print(temp.data, end=" ") ...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
""" This is a pure Python implementation of the merge sort algorithm For doctests run following command: python -m doctest -v merge_sort.py or python3 -m doctest -v merge_sort.py For manual testing run: python merge_sort.py """ def merge_sort(collection: list) -> list: """Pure implementation of the merge sort alg...
""" This is a pure Python implementation of the merge sort algorithm For doctests run following command: python -m doctest -v merge_sort.py or python3 -m doctest -v merge_sort.py For manual testing run: python merge_sort.py """ def merge_sort(collection: list) -> list: """Pure implementation of the merge sort alg...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
""" Project Euler Problem 50: https://projecteuler.net/problem=50 Consecutive prime sum The prime 41, can be written as the sum of six consecutive primes: 41 = 2 + 3 + 5 + 7 + 11 + 13 This is the longest sum of consecutive primes that adds to a prime below one-hundred. The longest sum of consecutive primes below on...
""" Project Euler Problem 50: https://projecteuler.net/problem=50 Consecutive prime sum The prime 41, can be written as the sum of six consecutive primes: 41 = 2 + 3 + 5 + 7 + 11 + 13 This is the longest sum of consecutive primes that adds to a prime below one-hundred. The longest sum of consecutive primes below on...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
# Information on binary shifts: # https://docs.python.org/3/library/stdtypes.html#bitwise-operations-on-integer-types # https://www.interviewcake.com/concept/java/bit-shift def logical_left_shift(number: int, shift_amount: int) -> str: """ Take in 2 positive integers. 'number' is the integer to be logical...
# Information on binary shifts: # https://docs.python.org/3/library/stdtypes.html#bitwise-operations-on-integer-types # https://www.interviewcake.com/concept/java/bit-shift def logical_left_shift(number: int, shift_amount: int) -> str: """ Take in 2 positive integers. 'number' is the integer to be logical...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
""" The Mandelbrot set is the set of complex numbers "c" for which the series "z_(n+1) = z_n * z_n + c" does not diverge, i.e. remains bounded. Thus, a complex number "c" is a member of the Mandelbrot set if, when starting with "z_0 = 0" and applying the iteration repeatedly, the absolute value of "z_n" remains bounded...
""" The Mandelbrot set is the set of complex numbers "c" for which the series "z_(n+1) = z_n * z_n + c" does not diverge, i.e. remains bounded. Thus, a complex number "c" is a member of the Mandelbrot set if, when starting with "z_0 = 0" and applying the iteration repeatedly, the absolute value of "z_n" remains bounded...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
from typing import List class Node: def __init__(self, data=None): self.data = data self.next = None def __repr__(self): """Returns a visual representation of the node and all its following nodes.""" string_rep = [] temp = self while temp: string_re...
from typing import List class Node: def __init__(self, data=None): self.data = data self.next = None def __repr__(self): """Returns a visual representation of the node and all its following nodes.""" string_rep = [] temp = self while temp: string_re...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
class FlowNetwork: def __init__(self, graph, sources, sinks): self.sourceIndex = None self.sinkIndex = None self.graph = graph self._normalizeGraph(sources, sinks) self.verticesCount = len(graph) self.maximumFlowAlgorithm = None # make only one source and one si...
class FlowNetwork: def __init__(self, graph, sources, sinks): self.sourceIndex = None self.sinkIndex = None self.graph = graph self._normalizeGraph(sources, sinks) self.verticesCount = len(graph) self.maximumFlowAlgorithm = None # make only one source and one si...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
""" This algorithm (k=33) was first reported by Dan Bernstein many years ago in comp.lang.c Another version of this algorithm (now favored by Bernstein) uses xor: hash(i) = hash(i - 1) * 33 ^ str[i]; First Magic constant 33: It has never been adequately explained. It's magic because it works better tha...
""" This algorithm (k=33) was first reported by Dan Bernstein many years ago in comp.lang.c Another version of this algorithm (now favored by Bernstein) uses xor: hash(i) = hash(i - 1) * 33 ^ str[i]; First Magic constant 33: It has never been adequately explained. It's magic because it works better tha...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
""" Convert between different units of temperature """ def celsius_to_fahrenheit(celsius: float, ndigits: int = 2) -> float: """ Convert a given value from Celsius to Fahrenheit and round it to 2 decimal places. Wikipedia reference: https://en.wikipedia.org/wiki/Celsius Wikipedia reference: https://en...
""" Convert between different units of temperature """ def celsius_to_fahrenheit(celsius: float, ndigits: int = 2) -> float: """ Convert a given value from Celsius to Fahrenheit and round it to 2 decimal places. Wikipedia reference: https://en.wikipedia.org/wiki/Celsius Wikipedia reference: https://en...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
# Minimum cut on Ford_Fulkerson algorithm. test_graph = [ [0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], [0, 4, 0, 0, 14, 0], [0, 0, 9, 0, 0, 20], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def BFS(graph, s, t, parent): # Return True if there is node that has not iterated. visited = [Fals...
# Minimum cut on Ford_Fulkerson algorithm. test_graph = [ [0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], [0, 4, 0, 0, 14, 0], [0, 0, 9, 0, 0, 20], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def BFS(graph, s, t, parent): # Return True if there is node that has not iterated. visited = [Fals...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
# flake8: noqa """ Binomial Heap Reference: Advanced Data Structures, Peter Brass """ class Node: """ Node in a doubly-linked binomial tree, containing: - value - size of left subtree - link to left, right and parent nodes """ def __init__(self, val): self.val = val ...
# flake8: noqa """ Binomial Heap Reference: Advanced Data Structures, Peter Brass """ class Node: """ Node in a doubly-linked binomial tree, containing: - value - size of left subtree - link to left, right and parent nodes """ def __init__(self, val): self.val = val ...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
#!/usr/bin/env python3 """ This program calculates the nth Fibonacci number in O(log(n)). It's possible to calculate F(1_000_000) in less than a second. """ from __future__ import annotations import sys def fibonacci(n: int) -> int: """ return F(n) >>> [fibonacci(i) for i in range(13)] [0, 1, 1, 2, ...
#!/usr/bin/env python3 """ This program calculates the nth Fibonacci number in O(log(n)). It's possible to calculate F(1_000_000) in less than a second. """ from __future__ import annotations import sys def fibonacci(n: int) -> int: """ return F(n) >>> [fibonacci(i) for i in range(13)] [0, 1, 1, 2, ...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
""" A Python implementation of the quick select algorithm, which is efficient for calculating the value that would appear in the index of a list if it would be sorted, even if it is not already sorted https://en.wikipedia.org/wiki/Quickselect """ import random def _partition(data: list, pivot) -> tuple: """ T...
""" A Python implementation of the quick select algorithm, which is efficient for calculating the value that would appear in the index of a list if it would be sorted, even if it is not already sorted https://en.wikipedia.org/wiki/Quickselect """ import random def _partition(data: list, pivot) -> tuple: """ T...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
""" Project Euler Problem 6: https://projecteuler.net/problem=6 Sum square difference The sum of the squares of the first ten natural numbers is, 1^2 + 2^2 + ... + 10^2 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)^2 = 55^2 = 3025 Hence the difference between the sum of...
""" Project Euler Problem 6: https://projecteuler.net/problem=6 Sum square difference The sum of the squares of the first ten natural numbers is, 1^2 + 2^2 + ... + 10^2 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)^2 = 55^2 = 3025 Hence the difference between the sum of...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
"""Implementation of GradientBoostingRegressor in sklearn using the boston dataset which is very popular for regression problem to predict house price. """ import matplotlib.pyplot as plt import pandas as pd from sklearn.datasets import load_boston from sklearn.ensemble import GradientBoostingRegressor from skle...
"""Implementation of GradientBoostingRegressor in sklearn using the boston dataset which is very popular for regression problem to predict house price. """ import matplotlib.pyplot as plt import pandas as pd from sklearn.datasets import load_boston from sklearn.ensemble import GradientBoostingRegressor from skle...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
import string from math import log10 """ tf-idf Wikipedia: https://en.wikipedia.org/wiki/Tf%E2%80%93idf tf-idf and other word frequency algorithms are often used as a weighting factor in information retrieval and text mining. 83% of text-based recommender systems use tf-idf for term weighting. In L...
import string from math import log10 """ tf-idf Wikipedia: https://en.wikipedia.org/wiki/Tf%E2%80%93idf tf-idf and other word frequency algorithms are often used as a weighting factor in information retrieval and text mining. 83% of text-based recommender systems use tf-idf for term weighting. In L...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
def gcd(a: int, b: int) -> int: while a != 0: a, b = b % a, a return b def find_mod_inverse(a: int, m: int) -> int: if gcd(a, m) != 1: raise ValueError(f"mod inverse of {a!r} and {m!r} does not exist") u1, u2, u3 = 1, 0, a v1, v2, v3 = 0, 1, m while v3 != 0: q = u3 // v...
def gcd(a: int, b: int) -> int: while a != 0: a, b = b % a, a return b def find_mod_inverse(a: int, m: int) -> int: if gcd(a, m) != 1: raise ValueError(f"mod inverse of {a!r} and {m!r} does not exist") u1, u2, u3 = 1, 0, a v1, v2, v3 = 0, 1, m while v3 != 0: q = u3 // v...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
# Created by susmith98 from collections import Counter from timeit import timeit # Problem Description: # Check if characters of the given string can be rearranged to form a palindrome. # Counter is faster for long strings and non-Counter is faster for short strings. def can_string_be_rearranged_as_palindrome_count...
# Created by susmith98 from collections import Counter from timeit import timeit # Problem Description: # Check if characters of the given string can be rearranged to form a palindrome. # Counter is faster for long strings and non-Counter is faster for short strings. def can_string_be_rearranged_as_palindrome_count...
-1
TheAlgorithms/Python
4,314
fix(mypy): type annotations for conversions algorithms
### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have ...
dhruvmanila
2021-04-04T13:03:20Z
2021-04-04T13:25:49Z
536fb4bca48f69cb66cfbd03aeb02550def07977
20c7518028efbb6e8ae46a42b28c3f2e27acb2a2
fix(mypy): type annotations for conversions algorithms. ### **Describe your change:** * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)...
-1