This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Copyright (c) 2009 Microsoft Corporation. All rights reserved. | |
C:\Users\someuser\Desktop\leven-1.0.4>python setup.py install | |
running install | |
running bdist_egg | |
running egg_info | |
writing requirements to leven.egg-info\requires.txt | |
writing leven.egg-info\PKG-INFO | |
writing top-level names to leven.egg-info\top_level.txt | |
writing dependency_links to leven.egg-info\dependency_links.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = "Alonso Gutierrez" | |
# Give input integer n, find the next prime | |
def find_next_prime(n): | |
isprime = False | |
n += 1 | |
while (not isprime): | |
# print n | |
isprime = True | |
if n % 2 == 0: | |
# print 'n is even' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Write a function that wil receive a big number as a string | |
and a number of digits to multiply and will return the biggest | |
product contained in the number. | |
IO: NUMB (big number), int (number of digits to multiply | |
''' | |
def adjacent_digits_product(NUMB, n): | |
my_str = str(NUMB) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Return anagrams of the same word | |
To optimize in future can use bit strings | |
''' | |
def find_anagrams(list_of_anagrams, word): | |
l = [] | |
for s in list_of_anagrams: | |
if sorted(word) == sorted(s): | |
l.append(s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
customers = {} | |
for i in range(n): | |
size, price = input().split() | |
customers[size] = price | |
# To comprehension |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def func(row): | |
return int(row.split()[k]) | |
if __name__ == '__main__': | |
n, m = map(int, input().split()) | |
rows = [input() for _ in range(n)] | |
k = int(input()) | |
# for row in sorted(rows, key=lambda row: int(row.split()[k])): #works |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Pattern matching problem | |
Boyer Moore algorithm | |
First is my attempt, below is the code provided in the book | |
Idea: | |
Optimize brute force approach using 2 heuristics: | |
- Looking-Glass: start searches from last character of the | |
pattern and work backwards | |
- Character-Jump: During testing of a pattern P, a mismatch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Pattern matching problem | |
Boyer Moore algorithm | |
First is my attempt, below is the code provided in the book | |
Idea: | |
Optimize brute force approach using 2 heuristics: | |
- Looking-Glass: start searches from last character of the | |
pattern and work backwards | |
- Character-Jump: During testing of a pattern P, a mismatch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
imagePullSecrets: | |
- name: some-secret | |
kind: ServiceAccount | |
metadata: | |
name: devops-sa | |
namespace: devops | |
---- | |
kind: Role |