This file contains 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
/** | |
* 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{ |
This file contains 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
/** | |
* Created by bitcpf on 6/17/14. | |
*/ | |
public class reverseString { | |
public static char[] reverse(String s){ | |
char[] s_char = s.toCharArray(); | |
char inter; |
This file contains 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
/** | |
* | |
* @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]; |
This file contains 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
/* | |
Created by bitcpf, 6/19/2014 | |
*/ | |
public class replaceString { | |
public static char[] replace(String s){ | |
This file contains 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
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; |
This file contains 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
/* | |
Created by bitcpf | |
*/ | |
public class Imagerotate { | |
public static int[][] Rotate(int[][] testimg){ | |
for (int i = 0; i < testimg.length/2; i ++){ | |
int first = i; |
This file contains 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
/* | |
Created by bitcpf | |
*/ | |
public class Replacezero { | |
public static int[][] setzero(int[][] matrix){ | |
int[] zero_row = new int[matrix.length]; |
This file contains 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
/* | |
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>(); |
This file contains 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 java.util.Iterator; | |
import java.util.LinkedList; | |
/* | |
* Created by bitcpf | |
*/ | |
public class Lastkey { | |
This file contains 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
public class Node<Item> { | |
public Item item = null; | |
public Node<Item> next = null; | |
public Node (Item item) { | |
this.item = item; | |
this.next = null; | |
} | |
} |
OlderNewer