Shfited to complexity-score.
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
import unittest | |
def zigzag(cs, num_rows): | |
""" | |
Authored by Dhruv - TA will be Dhruv. | |
In order to encode text messages in a format that is unreadable to other, | |
Alice decides to create a cipher and wants a program to test it out on her | |
messages. The cipher (which is essentially an algorithm) rewrites a text | |
message, taken in as a string of contiguous characters, with the use of 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
import unittest | |
def compress_numbers_helper(ts): | |
""" | |
This helper function takes in a list of tuples indicating the ranges of | |
numbers and outputs the compressed numbers as an iterator of strings. | |
""" | |
for start, end in ts: | |
# handle singleton ranges | |
if start == end: |
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
import unittest | |
def checksum_helper(plate): | |
""" | |
This helper function converts a license plate comprising an alphabetical | |
prefix (which can have one to three letters) and a numeral suffix num (which | |
can have one to four digits) into a tuple of six numbers. | |
""" | |
def split_plate(plate): | |
i = 0 |
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
import numpy as np | |
import matplotlib.pyplot as plt | |
# importing data from csv file | |
xs, ys, zs = np.loadtxt("data.txt", unpack=True, delimiter=",", dtype=float, skiprows=0) | |
# labels | |
plt.xlabel("No. of PT-CT Pairs per Distinguisher") | |
plt.ylabel("lg2(T(N))") | |
plt.title("Lower Bound on Time Complexity of Single and Double Distinguisher Attack") |
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
%{ | |
#include <stdio.h> | |
#include <string.h> | |
enum yytokentype { | |
COMMA = 258, | |
SEMICOLON, | |
LBRACKET, | |
RBRACKET, | |
LBRACE, |
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
%{ | |
#include <stdio.h> | |
enum yytokentype { | |
COMMA = 258, | |
SEMICOLON = 259 | |
}; | |
char *yylval; | |
%} |
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
# Shifted this file to my blog | |
The new link is on my blog: https://wei2912.github.io/index.html#introduction_to_haskell | |
I'll update the post on my blog from now on. | |
--- | |
Introduction to Haskell | |
--- |
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
""" | |
https://www.reddit.com/r/lpmc/comments/2eblaq/challenge_list_of_numbers_0_valid_triangles/ | |
author: wei2912 | |
This solution assumes that the values can be taken from the list with | |
replacement and the order of the side lengths matter. | |
To determine if a triangle is valid, the sum of each 2 sides must be greater | |
than the other side. |
C Basics Tutorial by Subsentient #