-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from AmodhShenoy/master
Cryptober code
- Loading branch information
Showing
31 changed files
with
1,371 additions
and
7 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Generated by Django 2.2.6 on 2019-10-10 19:11 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('blogs', '0048_auto_20190905_0552'), | ||
('blogs', '0048_auto_20190905_1751'), | ||
] | ||
|
||
operations = [ | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 2.2.6 on 2019-10-10 19:14 | ||
|
||
import datetime | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('blogs', '0049_merge_20191010_1911'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='bloghits', | ||
name='created', | ||
field=models.DateTimeField(default=datetime.datetime(2019, 10, 10, 19, 14, 12, 3807)), | ||
), | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 2.2.6 on 2019-10-10 19:39 | ||
|
||
import datetime | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('blogs', '0050_auto_20191010_1914'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='bloghits', | ||
name='created', | ||
field=models.DateTimeField(default=datetime.datetime(2019, 10, 10, 19, 39, 15, 794434)), | ||
), | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Dynamic programming Python implementation of LIS problem | ||
|
||
# lis returns length of the longest increasing subsequence | ||
# in arr of size n | ||
def lis(arr): | ||
n = len(arr) | ||
|
||
# Declare the list (array) for LIS and initialize LIS | ||
# values for all indexes | ||
lis = [1]*n | ||
|
||
# Compute optimized LIS values in bottom up manner | ||
for i in range (1 , n): | ||
for j in range(0 , i): | ||
if arr[i] > arr[j] and lis[i]< lis[j] + 1 : | ||
lis[i] = lis[j]+1 | ||
|
||
# Initialize maximum to 0 to get the maximum of all | ||
# LIS | ||
maximum = 0 | ||
|
||
# Pick maximum of all LIS values | ||
for i in range(n): | ||
maximum = max(maximum , lis[i]) | ||
|
||
return maximum | ||
# end of lis function | ||
|
||
# Driver program to test above function | ||
arr =[3, 10, 2, 1, 20] | ||
print(lis(arr)) | ||
# This code is contributed by Nikhil Kumar Singh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#Logic: This program prints the diffrence of cube | ||
#of number having maximum abslute value and minimum absolute value. | ||
|
||
def solve(a): | ||
minv=1000000000 | ||
maxv=0 | ||
for i in a: | ||
minv=min(minv,abs(i)) | ||
maxv=max(maxv,abs(i)) | ||
|
||
# print(maxv,minv) | ||
return (maxv*maxv*maxv-minv*minv*minv) | ||
|
||
|
||
a = [1,2,-1,2,-1] | ||
print(solve(a)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#Logic: Print no. of charaters that are repeated passed string | ||
|
||
def printDups(string): | ||
count = [0] * 256 | ||
for i in string: | ||
count[ord(i)] += 1 | ||
k = 0 | ||
cnt=0; | ||
for i in count: | ||
if int(i) > 1: | ||
cnt=cnt+1; | ||
return cnt; | ||
|
||
|
||
|
||
# Driver program to test the above function | ||
string = ['a','a'] | ||
print(printDups(string)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# A Dynamic Programming based Python program for edit | ||
# distance problem : | ||
# minimum number of edits (operations) required to convert ‘str1’ into ‘str2’. | ||
#allowed operations: | ||
#Insert | ||
#Remove | ||
#Replace | ||
def editDistDP(str1, str2, m, n): | ||
# Create a table to store results of subproblems | ||
dp = [[0 for x in range(n+1)] for x in range(m+1)] | ||
|
||
# Fill d[][] in bottom up manner | ||
for i in range(m+1): | ||
for j in range(n+1): | ||
|
||
# If first string is empty, only option is to | ||
# insert all characters of second string | ||
if i == 0: | ||
dp[i][j] = j # Min. operations = j | ||
|
||
# If second string is empty, only option is to | ||
# remove all characters of second string | ||
elif j == 0: | ||
dp[i][j] = i # minimumn. operations = i | ||
|
||
# If last characters are same, ignore last char | ||
# and recur for remaining string | ||
elif str1[i-1] == str2[j-1]: | ||
dp[i][j] = dp[i-1][j-1] | ||
|
||
# If last character are different, consider all | ||
# possibilities and find minimum | ||
else: | ||
dp[i][j] = 1 + min(dp[i][j-1], # Insert | ||
dp[i-1][j], # Remove | ||
dp[i-1][j-1]) # Replace | ||
|
||
return dp[m][n] | ||
|
||
# Driver program | ||
str1 = "iste" | ||
str2 = "nitk" | ||
|
||
print(editDistDP(str1, str2, len(str1), len(str2))) | ||
# This code is contributed by Bhavya Jain |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# LOGIC:Python program to print diffrence between sum of even array indices and | ||
#sum of odd array indices | ||
|
||
def solve(a): | ||
sumodd=0 | ||
sumeven=0; | ||
for i in range(0,len(a)): | ||
if(i%2==0): | ||
sumeven+=a[i]; | ||
else: | ||
sumodd+=a[i]; | ||
|
||
return sumeven-sumodd | ||
|
||
a = [200,100,1000,150,250] | ||
print(solve(a)) |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from django.contrib import admin | ||
from .models import Response | ||
# Register your models here. | ||
admin.register(Response) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class CryptoberConfig(AppConfig): | ||
name = 'cryptober' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Generated by Django 2.2.6 on 2019-10-10 19:14 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Response', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(default='', max_length=200)), | ||
('email', models.EmailField(max_length=254)), | ||
('input1', models.CharField(default='', max_length=100)), | ||
('input2', models.CharField(default='', max_length=100)), | ||
('input3', models.CharField(default='', max_length=100)), | ||
('input4', models.CharField(default='', max_length=100)), | ||
('input5', models.CharField(default='', max_length=100)), | ||
], | ||
), | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Generated by Django 2.2.6 on 2019-10-10 19:39 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('cryptober', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='response', | ||
name='input1', | ||
field=models.CharField(default='[]', max_length=100), | ||
), | ||
migrations.AlterField( | ||
model_name='response', | ||
name='input2', | ||
field=models.CharField(default='[]', max_length=100), | ||
), | ||
migrations.AlterField( | ||
model_name='response', | ||
name='input3', | ||
field=models.CharField(default='[]', max_length=100), | ||
), | ||
migrations.AlterField( | ||
model_name='response', | ||
name='input4', | ||
field=models.CharField(default='[]', max_length=100), | ||
), | ||
migrations.AlterField( | ||
model_name='response', | ||
name='input5', | ||
field=models.CharField(default='[]', max_length=100), | ||
), | ||
] |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from django.db import models | ||
from ckeditor_uploader.fields import RichTextUploadingField | ||
import uuid | ||
import datetime | ||
|
||
|
||
class Response(models.Model): | ||
name = models.CharField(default="",max_length=200) | ||
email = models.EmailField() | ||
input1 = models.CharField(default="[]",max_length=100) | ||
input2 = models.CharField(default="[]",max_length=100) | ||
input3 = models.CharField(default="[]",max_length=100) | ||
input4 = models.CharField(default="[]",max_length=100) | ||
input5 = models.CharField(default="[]",max_length=100) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" dir="ltr"> | ||
<head> | ||
<meta charset="utf-8"> | ||
|
||
<style> | ||
body { | ||
text-align:center; | ||
font-family: "Arial"; | ||
} | ||
li{ | ||
display: inline; | ||
} | ||
a{ | ||
text-decoration: None; | ||
} | ||
.simple-input { | ||
display: inline-block; | ||
padding: 5px; | ||
border: 4px solid #F1B720; | ||
border-radius: 5px; | ||
color: #333; | ||
transition: all 0.3s ease-out; | ||
} | ||
.simple-input:hover{ | ||
border-radius: 8px; | ||
} | ||
.simple-input:focus { | ||
outline: none; | ||
border-radius: 8px; | ||
border-color: #EBD292; | ||
} | ||
|
||
.bordered{ | ||
width:98%; | ||
display: inline-block; | ||
padding: 8px; | ||
border: 3px solid #FCB326; | ||
border-radius: 6px; | ||
box-shadow: | ||
0 2px 1px rgba(0, 0, 0, 0.2), | ||
inset 0 2px 1px rgba(0, 0, 0, 0.2); | ||
|
||
/* Font styles */ | ||
text-decoration: none; | ||
font-size: 14px; | ||
text-transform: uppercase; | ||
color: #222; | ||
} | ||
|
||
.metro { | ||
display: inline-block; | ||
padding: 10px; | ||
margin: 10px; | ||
background: #08C; | ||
|
||
/* Font styles */ | ||
color: white; | ||
font-weight: bold; | ||
text-decoration: none; | ||
} | ||
|
||
.metro.three-d { | ||
position: relative; | ||
box-shadow: | ||
1px 1px #53A7EA, | ||
2px 2px #53A7EA, | ||
3px 3px #53A7EA; | ||
transition: all 0.1s ease-in; | ||
} | ||
.metro { | ||
display: inline-block; | ||
padding: 10px; | ||
margin: 10px; | ||
background: #08C; | ||
|
||
/* Font styles */ | ||
color: white; | ||
font-weight: bold; | ||
text-decoration: none; | ||
} | ||
|
||
.metro.three-d:active { | ||
box-shadow: none; | ||
top: 3px; | ||
left: 3px; | ||
} | ||
|
||
.inline-link-2 { | ||
display: inline-block; | ||
border-bottom: 1px dashed rgba(0,0,0,0.4); | ||
|
||
/* Font styles */ | ||
text-decoration: none; | ||
color: #777; | ||
} | ||
|
||
.inline-link-2:hover { border-bottom-style: dotted; } | ||
.inline-link-2:active { border-bottom-style: solid; } | ||
.inline-link-2:visited { border-bottom: 1px solid #97CAF2; } | ||
</style> | ||
|
||
|
||
<link rel="stylesheet" href="styles.css"> | ||
<title>ERROR!</title> | ||
</head> | ||
<body class="bordered"> | ||
<h1 text-align"center">ERROR! Your input is invalid! Try again!</h1> | ||
<ul> | ||
<li class="inline-link-2"><a href="1">1</a></li> | ||
<li class="inline-link-2"><a href="2">2</a></li> | ||
<li class="inline-link-2"><a href="3">3</a></li> | ||
<li class="inline-link-2"><a href="4">4</a></li> | ||
<li class="inline-link-2"><a href="5">5</a></li> | ||
</ul> | ||
</body> | ||
</html> |
Oops, something went wrong.