This file contains hidden or 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 <iostream> | |
| #include <vector> | |
| using namespace std; | |
| int min(const int a, const int b) { | |
| return a > b ? b : a; | |
| } | |
| int sum(const int a, const int b) { | |
| return a + b; |
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "math/rand" | |
| "sync" | |
| "time" | |
| ) | |
| func a(i int, cs chan<- int) { |
This file contains hidden or 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 React from 'react' | |
| import ReactDOM from 'react-dom' | |
| import makeAsyncScriptLoader from "react-async-script" | |
| class App extends React.Component { | |
| appendPre(message) { | |
| const pre = document.getElementById('output') | |
| const textContent = document.createTextNode(message + '\n') | |
| pre.appendChild(textContent) | |
| } |
This file contains hidden or 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 <iostream> | |
| #include <string> | |
| #include <vector> | |
| #include <algorithm> | |
| #include <unordered_set> | |
| using namespace std; | |
| void printSubstring(string s, vector<string> substrings) { | |
| if (substrings.empty()) return; |
This file contains hidden or 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. | |
| * struct ListNode { | |
| * int val; | |
| * struct ListNode *next; | |
| * }; | |
| */ | |
| struct ListNode* addTwoNumbers(struct ListNode* l1, struct ListNode* l2) { | |
| if (!l1) return l2; | |
| if (!l2) return l1; |
This file contains hidden or 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
| char* multiply(char* num1, char* num2) { | |
| if (!num1 || !num2) return NULL; | |
| if (num1[0] == '0' || num2[0] == '0') return "0"; | |
| int len1 = strlen(num1), len2 = strlen(num2); | |
| if (len1 == 1 && num1[0] == '1') return num2; | |
| if (len2 == 1 && num2[0] == '1') return num1; | |
| char *result = malloc((len1+len2)*sizeof(char)); | |
| memset(result, '0', (len1+len2)*sizeof(char)); | |
| for (int i = len1-1; i >= 0; i--) { | |
| int carry = 0; |
This file contains hidden or 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 <stdlib.h> | |
| #include <limits.h> | |
| #define PARENT(i) (((i+1)>>1)-1) | |
| #define LEFT(i) (((i+1)<<1)-1) | |
| #define RIGHT(i) ((i+1)<<1) | |
| /** | |
| * Definition for singly-linked list. |
This file contains hidden or 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: | |
| # @return a list of lists of length 3, [[val1,val2,val3]] | |
| def threeSum(self, num): | |
| if len(num) < 3: | |
| return [] | |
| threes = [] | |
| countMap = dict() | |
| for i in num: | |
| if i in countMap: | |
| countMap[i] += 1 |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| import random | |
| from bisect import bisect | |
| from itertools import accumulate | |
| from collections import Counter | |
| import sys | |
| total = 180 | |
| n = 15 |
This file contains hidden or 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
| <? | |
| if(file_exists('/www/global/lockdown')) { | |
| if($_COOKIE['4chan_auser'] && $_COOKIE['4chan_apass'] && ($_POST['mode']=='usrdel'||$_GET['mode']=='latest')) { | |
| // ok | |
| } | |
| else { | |
| die('Posting temporarily disabled. Come back later!<br/>—Team 4chan (uptime? what\'s that?)'); | |
| } | |
| } | |
| include_once "./yotsuba_config.php"; |
NewerOlder