Skip to content

Instantly share code, notes, and snippets.

@KorbenC
KorbenC / ConvertNumToText.java
Created April 4, 2014 15:09
Print out the text form of numbers from 1 - 1000000(eg 20 is "twenty")
public class ConvertNumToText {
public static String[] digits = {"One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"};
public static String[] teens = {"Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"};
public static String[] tens = {"Ten", "Twenty", "Thirty", "Fourty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"};
public static String[] bigs = {"", "Thousand", "Million"};
public static void main(String[] args) {
for (int i = 1; i < 1000001; i++){
System.out.println(numToString(i));
@KorbenC
KorbenC / replace_spaces.py
Created April 3, 2014 15:03
Write a method that replace all spaces in a string with '%20'
#!/usr/bin/env python
import sys
str = 'The knights who sy ni!'
for char in str:
if char == ' ':
str = str.replace(' ', '%20')
print str
@KorbenC
KorbenC / print_numbers.py
Last active August 29, 2015 13:57
Print out the text form of numbers from 1 - 1000(eg 20 is "twenty")
#!/usr/bin/env python
import sys
map = {
1:'one',
2:'two',
3:'three',
4:'four',
5:'five',
6:'six',
@KorbenC
KorbenC / FindReplaceHLinks.vba
Created March 26, 2014 15:51
Find and replace hyperlinks in excel wkbk.
@KorbenC
KorbenC / code_sample.md
Last active August 29, 2015 13:57
Code sample ideas
  • A utility class for logging events and errors either to a file or the system event logs with a configurable level of verbosity.
  • A set of stored procedures for maintaining and searching data in a hierarchical tree structure.
  • An implementation of the singleton design pattern to serialize access to a resource file.
  • A calculator function that takes a single string of input that includes numbers and operators and returns the numeric result of the equation. Don’t forget input validation, error handling (divide by zero), and operator precedence concerns!
  • A method that takes a URL to a web site and a local path and downloads all image files based on tags.
  • Create a method that takes a keyword, message, and login credentials and uses the Twitter API to respond to post the message as response to any friends of the account specified.
@KorbenC
KorbenC / Questions you should always ask on a job interview.md
Last active August 29, 2015 13:55 — forked from jondruse/Questions you should always ask on a job interview
Set the groundwork for success. Come prepared with a list of questions about the position and company. This is your chance to really show your interest.

#General Questions:

  1. What is the dress code?
  2. What are the normal business hours?
  3. What are my immediate supervisor's hours?
  4. Do you offer benefits?
  5. What is the waiting period for benefits?
  6. What is your policy on working from home?
  7. How much vacation/sick time would I get?
  8. What is the average employment length?
@KorbenC
KorbenC / sudoku.py
Created January 2, 2014 12:03
Simple Sudoku solver from an interview question
#!/usr/bin/env python
class MyException(Exception):
pass
import sys
def same_row(i,j):
return (i/9 == j/9)
def same_col(i,j):
return (i-j) % 9 == 0
@KorbenC
KorbenC / NumToLetterPerm.cpp
Created December 18, 2013 21:56
given a digit number print all of the possible strings you can make with it using the corresponding letters on the numbers
#include <iostream>
#include <map>
#include <vector>
#include <string>
using namespace std;
void initLetterMap(map<char,string> &lmap);
vector<string> getMapped(const string &phoneNumber, map<char,string> &lmap);
vector<string> getPermutations(vector<string> number);
@KorbenC
KorbenC / perms.py
Last active December 31, 2015 18:39
given a digit number print all of the possible strings you can make with it using the corresponding letters on the numbers
#!/usr/bin/env python
import sys
digit_map = {
'2': 'abc',
'3': 'def',
'4': 'ghi',
'5': 'jkl',
'6': 'mno',
@KorbenC
KorbenC / mxnmatrix.cpp
Created December 18, 2013 18:52
Write an algorithm such that if an element in an MxN matrix is 0, its entire row and column is set to 0.
#include<iostream>
using namespace std;
int main()
{
int m = 3;
int n = 3;
int array[3][3] = {{1,2,3},{4,5,6}, {7,8,9}};
int row[3*3];
int column[3*3];