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
class Solution { | |
public: | |
vector<int> twoSum(vector<int>& nums, int target) { | |
multimap<int, int> nTable; | |
multimap<int, int>::iterator it, cur; | |
vector<int> result; | |
for(int i = 0; i < nums.size(); i++) | |
nTable.insert(make_pair(nums[i], i)); |
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
from tkinter import * | |
import tkinter.filedialog as filedialog | |
import tkinter.messagebox as msgbox | |
import pygame | |
import pygame.mixer as player | |
from enum import Enum | |
_BG_COLOR = 'black' | |
_FG_COLOR = 'red' | |
_FG_ALT_COLOR = 'white' |
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
from turtle import * | |
import random | |
import time | |
def change_color(t): | |
R = random.random() | |
B = random.random() | |
G = random.random() | |
t.pencolor(R, G, B) |
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 <NewPing.h> | |
#include <SPI.h> | |
#include <Wire.h> | |
#include <Adafruit_GFX.h> | |
#include <Adafruit_SSD1306.h> | |
#define SCREEN_WIDTH 128 // OLED display width, in pixels | |
#define SCREEN_HEIGHT 64 // OLED display height, in pixels | |
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) |
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> // 函式 printf 的 header file | |
#include<stdlib.h>// 函式 system 的 header file | |
int main(void) { | |
printf("嘻嘻嘻嘻嘻\n"); // 輸出文字 | |
printf(" CCCCcc\n"); | |
printf(" CC\n"); | |
printf(" C\n"); | |
printf("CC\n"); | |
printf(" C\n"); |
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 <Adafruit_NeoPixel.h> | |
#define LDR_PIN A0 | |
#define PIN 2 // input pin Neopixel is attached to | |
#define NUMPIXELS 12 // number of neopixels in Ring | |
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); | |
int delayval = 0; // timing delay |
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 <Adafruit_NeoPixel.h> | |
#define F_BTN_PIN 3 // forward button | |
#define B_BTN_PIN 4 // backward button | |
#define PIN 2 // input pin Neopixel is attached to | |
#define NUMPIXELS 24 // number of neopixels in Ring | |
#define HALF_NUMPIXELS 12 |
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
int ledPins[] = {2,3,4,5,6,7,8,9,10,11}; // The LED pins | |
int num = sizeof(ledPins) / sizeof(int); | |
int delayMS = 100; | |
void setup() | |
{ | |
for (int i = 0; i < num ; i++) | |
{ | |
pinMode(ledPins[i], OUTPUT); | |
} |
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
int sPin = 2; // The base pin ID | |
int nLEDs = 10; // The number of LEDs | |
int delayMS = 100; | |
void setup() | |
{ | |
for (int i = sPin; i < sPin + nLEDs; i++) | |
{ | |
pinMode(i, OUTPUT); | |
} |
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
""" | |
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
BSD License | |
""" | |
import numpy as np | |
# data I/O | |
data = open('input.txt', 'r').read() # should be simple plain text file | |
chars = list(set(data)) | |
data_size, vocab_size = len(data), len(chars) |