User Tools

Site Tools


files:python3:alhpabet

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
files:python3:alhpabet [2018/09/14 16:32]
jguerin removed
— (current)
Line 1: Line 1:
-====== Kattis: Prime Sieve ====== 
-((Note: This page is a stub.)) 
  
-===== Python3 Source ===== 
-<file python alphabet.py> 
-# Modified from CLRS3e 
-def LCS(x,y): 
-    m, n = len(x), len(y) 
-    C = [[0] * (n + 1) for i in range(m+1)] 
-    for i in range(1, m+1): 
-        for j in range(1, n+1): 
-            if x[i-1] == y[j-1]: 
-                C[i][j] = C[i-1][j-1] + 1 
-            else: 
-                C[i][j] = max(C[i][j-1], C[i-1][j]) 
-    return C[-1][-1] 
- 
-a = list(input()) 
-b = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', \ 
-'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] 
- 
-al, bl = len(a), len(b) 
-print(26 - LCS(a, b)) 
-</file> 
- 
-===== Solution Explanation ===== 
- 
-==== Potential "gotchas" ==== 
- 
-==== Finding the Solution ==== 
files/python3/alhpabet.1536960728.txt.gz ยท Last modified: 2018/09/14 16:32 by jguerin