Skip to content

Instantly share code, notes, and snippets.

View kanglicheng's full-sized avatar
🦜
LLMs ftw

Stephen Cheng kanglicheng

🦜
LLMs ftw
View GitHub Profile
@alabid
alabid / maxsub.py
Created September 16, 2012 22:15
solution to max sub array problem in python
def maxSubArray(ls):
if len(ls) == 0:
raise Exception("Array empty") # should be non-empty
runSum = maxSum = ls[0]
i = 0
start = finish = 0
for j in range(1, len(ls)):
if ls[j] > (runSum + ls[j]):
@KWMalik
KWMalik / interviewitems.MD
Created September 16, 2012 22:04 — forked from amaxwell01/interviewitems.MD
My answers to over 100 Google interview questions

##Google Interview Questions: Product Marketing Manager

  • Why do you want to join Google? -- Because I want to create tools for others to learn, for free. I didn't have a lot of money when growing up so I didn't get access to the same books, computers and resources that others had which caused money, I want to help ensure that others can learn on the same playing field regardless of their families wealth status or location.
  • What do you know about Google’s product and technology? -- A lot actually, I am a beta tester for numerous products, I use most of the Google tools such as: Search, Gmaill, Drive, Reader, Calendar, G+, YouTube, Web Master Tools, Keyword tools, Analytics etc.
  • If you are Product Manager for Google’s Adwords, how do you plan to market this?
  • What would you say during an AdWords or AdSense product seminar?
  • Who are Google’s competitors, and how does Google compete with them? -- Google competes on numerous fields: --- Search: Baidu, Bing, Duck Duck Go
@amaxwell01
amaxwell01 / interviewitems.MD
Created September 15, 2012 14:17
My answers to over 100 Google interview questions

##Google Interview Questions: Product Marketing Manager

  • Why do you want to join Google? -- Because I want to create tools for others to learn, for free. I didn't have a lot of money when growing up so I didn't get access to the same books, computers and resources that others had which caused money, I want to help ensure that others can learn on the same playing field regardless of their families wealth status or location.
  • What do you know about Google’s product and technology? -- A lot actually, I am a beta tester for numerous products, I use most of the Google tools such as: Search, Gmaill, Drive, Reader, Calendar, G+, YouTube, Web Master Tools, Keyword tools, Analytics etc.
  • If you are Product Manager for Google’s Adwords, how do you plan to market this?
  • What would you say during an AdWords or AdSense product seminar?
  • Who are Google’s competitors, and how does Google compete with them? -- Google competes on numerous fields: --- Search: Baidu, Bing, Duck Duck Go
@rafaelcaricio
rafaelcaricio / insertion_sort.py
Created September 11, 2012 11:55
Insertion sort
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def insertion_sort(array):
size = len(array)
if size > 1:
for i in xrange(size):
j = i
@basarat
basarat / insertionsort.py
Created July 31, 2012 13:01
Insertion sort in python
def insertionsort(A):
#we start loop at second element (index 1) since the first item is already sorted
for j in range(1,len(A)):
key = A[j] #The next item we are going to insert into the sorted section of the array
i = j-1 #the last item we are going to compare to
#now we keep moving the key back as long as it is smaller than the last item in the array
while (i > -1) and key < A[i]: #if i == -1 means that this key belongs at the start
A[i+1]=A[i] #move the last object compared one step ahead to make room for key
i=i-1 #observe the next item for next time.
@robbielynch
robbielynch / NKueen.java
Created July 23, 2012 13:38
N Kueen - HackerRank Code Sprint - Interviewstreet.com
import java.util.ArrayList;
import java.util.Scanner;
public class NKueen {
private static ArrayList<Integer> kueens = new ArrayList<Integer>();
static int N = 0;
public static void main (String args[]){
@jimweirich
jimweirich / abstract.md
Created April 17, 2012 23:53
Berlin Clock Kata

Berlin Clock

Original Reference

Create a representation of the Berlin Clock for a given time (hh::mm:ss).

The Berlin Uhr (Clock) is a rather strange way to show the time. On the top of the clock there is a yellow lamp that blinks on/off every two seconds. The time is calculated by adding rectangular lamps.

@larsga
larsga / kata.py
Created March 28, 2012 07:09
Anagram code kata
def make_key(str):
key = list(str)
key.sort()
return "".join(key)
classes = {}
for line in open("wordlist.txt"):
word = line.strip().lower()
key = make_key(word)
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@alexkay
alexkay / gist:1600742
Created January 12, 2012 14:13
Code Sprint 2 - Quora Nearby
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;
struct Topic {