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
# Definition for singly-linked list. | |
# class ListNode: | |
# def __init__(self, val=0, next=None): | |
# self.val = val | |
# self.next = next | |
class Solution: | |
def rotateRight(self, head: ListNode, k: int) -> ListNode: | |
if not head or not head.next or k == 0: | |
return head | |
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
/** | |
* Definition for singly-linked list. | |
* public class ListNode { | |
* int val; | |
* ListNode next; | |
* ListNode() {} | |
* ListNode(int val) { this.val = val; } | |
* ListNode(int val, ListNode next) { this.val = val; this.next = next; } | |
* } | |
*/ |
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
-- ************************************************************* | |
-- This script creates the Food Flight Schema | |
-- for CST 438 Final Project | |
-- ************************************************************* | |
-- ******************************************** | |
-- CREATE THE FOODFLIGHT DATABASE | |
-- ******************************************* | |
-- create the database |
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
paragraph { | |
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
################################################################################# | |
## Make a Thanksgiving Card! # | |
# | |
############################################################################### | |
# drawCard: the card canvas is a scene with 3 pumpkins with cutouts for faces | |
############################################################################### | |
def drawCard(canvas): | |
# Three pics below should be of faces to draw on cutouts | |
pic1 = getPic() |
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 lineDrawingLambda(pic, DIFFERENCE): | |
# For each pixel in the picture, | |
# compare the luminance of that pixel to the luminance of the pixels to | |
# both the pixels below it and to the right. | |
for x in range(0, getWidth(pic) - 1): | |
for y in range(0, getHeight(pic) - 1): | |
px = getPixel(pic, x, y) #pixel to change | |
right = getPixel(pic, x+1, y) #pixel to right |
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 lineDrawing(pic): | |
DIFFERENCE = 10 | |
# Take a color picture and convert it to black and white | |
betterBnW(pic) | |
# For each pixel in the picture, | |
# compare the luminance of that pixel to the luminance of the pixels to | |
# both the pixels below it and to the right. | |
for x in range(0, getWidth(pic) - 1): | |
for y in range(0, getHeight(pic) - 1): | |
# If there is a large enough difference in the luminance between |
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
# Mirror an image horizontally, bottom to top | |
def mirrorBottomToTop(picture): | |
for x in range(0, getWidth(picture)): | |
for y in range(getHeight(picture)/2 , getHeight(picture)): | |
color = getColor(getPixel(picture, x, y)) | |
setColor(getPixel(picture, x, getHeight(picture) - y - 1), color) | |
show(picture) | |
return(picture) |
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
############################################ | |
# Implement chromakey | |
############################################ | |
# Parameters: pic is a greenscreen image, back is | |
# the background image. | |
def chromaKey(pic, back): | |
for x in range (0, getWidth(pic)): | |
for y in range(0, getHeight(pic)): | |
pic_p = getPixel(pic, x, y) | |
back_p = getPixel(back, x, y) |
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
############################################ | |
# Posterize a picture | |
############################################ | |
def artify(pic): | |
for p in getPixels(pic): | |
r = getRed(p) | |
g = getGreen(p) | |
b = getBlue(p) | |
#Red adjustment |
NewerOlder