Skip to content

Instantly share code, notes, and snippets.

View TheSithPadawan's full-sized avatar

Esther (EST) TheSithPadawan

  • Canada
View GitHub Profile
def find_word_concatenation(s, words):
result_indices = []
worddict = dict()
wordlen = len(words[0])
i, j = 0, 0
total = 0
for word in words:
if word not in worddict:
worddict[word] = 0
worddict[word] += 1
static ListNode *reverse(ListNode *head, int k) {
// TODO: Write your code here
ListNode * dummy = new ListNode(-1);
dummy->next = head;
ListNode * prev = dummy;
ListNode * cur = head;
ListNode * last_node_of_prev_list = prev;
ListNode * last_node_of_cur_list = cur;
while (cur) {
// https://leetcode.com/problems/longest-substring-without-repeating-characters/
#define um unordered_map
int solve (string s) {
um <char, int> ump;
int left = 0, right = 0;
int maxlen = 0;
int cnt = 0;
while (right < s.length()) {
ump[s[right]]++;
// notes for binary search lecture
// binary search is also used to search configurations with the following
// properties where we find the first True
// F F F F .... F (T) T T T ... T
// Apply binary search: to check that given the answer, is the configuration valid
/*
Example question: Aggressive cows (SPOJ)
N stalls on a straight line, C cows, no two cows can be tied to one stall.
Find the largest minimum distance of two cows of an assignment.
/*
This file organizes questions related to buying and selling
stocks
*/
/*
188. buy / sell stocks with transaction limit
buy (i,j): max profit on the ith day possible buy, total transaction limit
is j.
sell (i, j): max profit on the ith day possible sell, total transaction limit is j
/*
This file contains the core code for dynamic programming
related to string
*/
/* LC 10. Regular expression matching
dp (i,j): can first i char of s match first j char of p
case 1. p[j-1] != '*' and p[j-1] != '.' ==> function: dp[i-1][j-1] && s[i-1] == p[j-1]
case 2. p[j-1] == '.' ==> dp[i-1][j-1]
case 3. p[j-1] == '*'
// long and long int are identical
// int is optional
// long is a signed type size of long in c++: at least 32 bits
long x;
long int x;
// long long is a signed type of at least 64 bits
long long int x;
long long;
@TheSithPadawan
TheSithPadawan / hosting-on-github.md
Created July 28, 2020 05:28 — forked from TylerFisher/hosting-on-github.md
Basic steps for hosting on Github

Hey there, apparently people are still using this Gist from 2013! It's out of date! Consult the Github docs.

Steps for Hosting a Website on GitHub

  1. Create a GitHub account on github.com.
  2. Download either [GitHub for Mac][1] or [GitHub for Windows][2], depending on your operating system. Open the app and log in using the account you just created.
  3. (On Mac): After you login, click advanced and make sure that your name and email are correct. Then, click "Install Command Line Tools", just in case you want to start using the command line later in life.
  4. Create a new repository in your GitHub application. Name it your-username.github.io. The name is very important. Note the folder that GitHub is saving the repository to. Make sure the "Push to GitHub?" box is checked.
  5. Move your website's files into the folder that GitHub just created when you made the repository. IMPORTANT: Your homepage HTML file must be called "index.html", and it must exist in the top-level
@TheSithPadawan
TheSithPadawan / Literature Resources
Last active December 2, 2018 20:27
CSE 258 Literature
Translating Videos to Natural Languange using deep recurrent neural network
https://arxiv.org/pdf/1412.4729.pdf
Text Classification task using character-level covNet vs. deep learning methods (LSTM)
http://papers.nips.cc/paper/5782-character-level-convolutional-networks-for-text-classification.pdf
@TheSithPadawan
TheSithPadawan / GsonTest.java
Created November 29, 2018 18:49 — forked from julianbonilla/GsonTest.java
Read json from file into Gson
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import com.google.gson.Gson;
public class GsonTest {
public static void main(String[] args) throws FileNotFoundException {