Skip to content

Instantly share code, notes, and snippets.

@bitcpf
bitcpf / CC_1_1.java
Last active August 29, 2015 14:02
CC_1.1
/**
* Created by bitcpf on 6/16/14.
* Assume all character is ASCII
* Create a boolen matrix with all False
* Change the value if there is a character match the ASCII
*/
public class uniquestring{
/**
* Created by bitcpf on 6/17/14.
*/
public class reverseString {
public static char[] reverse(String s){
char[] s_char = s.toCharArray();
char inter;
/**
*
* @author bitcpf on June 18th
*
*/
public class permutation {
public static boolean stringpermutation(String s1, String s2){
// Default value is 0
int[] assic1 = new int[256];
/*
Created by bitcpf, 6/19/2014
*/
public class replaceString {
public static char[] replace(String s){
public class compression {
public static String stringcompression(String in_string) {
String result = "";
int s_len = in_string.length();
int i=0;
int char_cnt = 1;
/*
Created by bitcpf
*/
public class Imagerotate {
public static int[][] Rotate(int[][] testimg){
for (int i = 0; i < testimg.length/2; i ++){
int first = i;
/*
Created by bitcpf
*/
public class Replacezero {
public static int[][] setzero(int[][] matrix){
int[] zero_row = new int[matrix.length];
@bitcpf
bitcpf / remove_dup.java
Last active August 29, 2015 14:02
CC_2_1
/*
Created by bitcpf
*/
import java.util.*;
public class Removedup {
public static <Item> LinkedList<Item> Rmdup(LinkedList<Item> in_link){
HashSet<Item> set = new HashSet<Item>();
import java.util.Iterator;
import java.util.LinkedList;
/*
* Created by bitcpf
*/
public class Lastkey {
public class Node<Item> {
public Item item = null;
public Node<Item> next = null;
public Node (Item item) {
this.item = item;
this.next = null;
}
}