public static void main( String[] args )
    {
    	/*
    	 * Given following method signature, print all the combinations of the numbers: void combinations(int maxNumber);
    	 */
    	System.out.println("01---------------------------------------");   
		int[] sampleArray = { 1, 2, 3,4 };
    	ArrayList<Object> arr = new ArrayList<Object>();
		for(int i=0; i < sampleArray.length; i++)
			arr.add(sampleArray[i]);	
    	Combination com = new Combination();
    	ArrayList<ArrayList<Object>> ff = new ArrayList<ArrayList<Object>>();
    	ff = com.comp(arr);
		System.out.println("Combination is: " +ff.size() );
    	System.out.println(ff);   
    	
    	/*
    	 * Given N numbers, how to find the minimum M numbers of them? i.e, the minimum 3 numbers in 2,1,6,7,4,5,7,8 is 1,2,4.
    	 */
    	System.out.println("02---------------------------------------");   

    	int min[] = {2 ,1 ,6 ,7 ,4 ,5 ,7 ,8};
    	int num = 7;
		System.out.println("Minimum number : " + num);
    	System.out.println(MinNumber.findMinNumber(min, num)); 
    	
    	
    	/*
    	 * Given such definition of Linked List
    	 */
    	System.out.println("03---------------------------------------");   
    	//Exmple LinkedList is not cyclic, no loop or cycle found
    	LinkedListLoop linkedList = new LinkedListLoop();
		linkedList.appendIntoTail(new LinkedListLoop.Node("101")); 
		linkedList.appendIntoTail(new LinkedListLoop.Node("201")); 
		linkedList.appendIntoTail(new LinkedListLoop.Node("301"));
		linkedList.appendIntoTail(new LinkedListLoop.Node("401"));
		//System.out.println("Linked List : " + linkedList);
		if(linkedList.isCyclic()){
			System.out.println("Linked List is cyclic as it contains cycles or loop");
		}else{ 
			System.out.println("LinkedList is not cyclic, no loop or cycle found");
		}	
		//Exmple LinkedList is  cyclic
		LinkedListLoop linkedListLopp = new LinkedListLoop(); 
		linkedListLopp.appendIntoTail(new LinkedListLoop.Node("101")); 
		LinkedListLoop.Node cycle = new LinkedListLoop.Node("201"); 
		linkedListLopp.appendIntoTail(cycle); 
		linkedListLopp.appendIntoTail(new LinkedListLoop.Node("301")); 
		linkedListLopp.appendIntoTail(new LinkedListLoop.Node("401"));
		linkedListLopp.appendIntoTail(cycle);
		//System.out.println("Linked List : " + linkedListLopp);

		if(linkedListLopp.isCyclic())
		{ 
			System.out.println("Linked List is cyclic as it contains cycles or loop"); 
		}else{
			System.out.println("LinkedList is not cyclic, no loop or cycle found"); 
		} 
		
		
		/*
		 * Given a list of N people and let h be an unsorted array such that h( i) 
		 * is the height of a person i. A person height is between 10cm and 400cm.
		 *  If we form everyone in a line in an increasing order based on their height, 
		 *  what is the height of the middle person in this line?
		 */
    	System.out.println("04---------------------------------------");   
		int arrper[] = {130,142,143,153,154,155,166};
		ArrayList<Object> person = new ArrayList<Object>();
		for(int i=0; i < arrper.length; i++)
			person.add(arrper[i]);
    	System.out.println("Middle height of " + person + " is " + MiddleHeight.finfMiddleHeight(arrper));   
    	
    	int arrper1[] = {130,142,143,153,154,155,166,177};
		ArrayList<Object> person1 = new ArrayList<Object>();
		for(int i=0; i < arrper1.length; i++)
			person1.add(arrper1[i]);
    	System.out.println("Middle height of " + person1 + " is " + MiddleHeight.finfMiddleHeight(arrper1));   
    	
    	
    	/*
    	 * Given N total different shirts numbered from 1 to N and a number k of all different baskets (1<=k<=N)
    	 */
    	System.out.println("05---------------------------------------");   

    	System.out.println("2 shirts - 1 basket: " + ShirtBasket.keep(2, 1));// 2 shirts - 1 basket
		System.out.println("2 shirts - 2 basket: " + ShirtBasket.keep(2, 2));// 2 shirts - 2 basket
		System.out.println("2 shirts - 3 basket: " + ShirtBasket.keep(2, 3));// 2 shirts - 3 basket
		System.out.println("2 shirts - 4 basket: " + ShirtBasket.keep(4, 2));// 2 shirts - 4 basket
		
		
		/*
		 * Given an N*N matrix of integers, write code to rotate the matrix
		 */
    	System.out.println("06---------------------------------------");   

		int[][] matrix = {
				{1, 2, 3},
				{4,5,6},
				{7,8,9}};
		System.out.println("Before");
		MatrixRotate.print(matrix);
		System.out.println("After");
		MatrixRotate.print(MatrixRotate.rotate(matrix));
		
		
		/*
		 * Given two sorted integer array, find the Kth smallest element among both arrays
		 */
    	System.out.println("07---------------------------------------");   

		int[] array1 = { 2, 9, 15, 22, 24, 25, 26, 30 };
		int[] array2 = { 1, 4, 5, 7, 18, 22, 27, 33 };
		System.out.println("Kth smallest element is: " + KthSmallest.findKthValue(array1,array2, 6));
		
		
		/*
		 * Reverse a linked list without recursion
		 */
    	System.out.println("08---------------------------------------");   

		System.out.println("Reverse link list not recursion");
		ReverseNotRecursion list = new ReverseNotRecursion();
		ReverseNotRecursion.Node n1 = new ReverseNotRecursion.Node(1);
		ReverseNotRecursion.Node n2 = new ReverseNotRecursion.Node(2);
		ReverseNotRecursion.Node n3 = new ReverseNotRecursion.Node(3);
		n1._next = n2;
		n2._next = n3;
		list.head = n1;		
		list.printV();
		list.reverse_all();
		list.printV();   
		
		/*
		 * Given two unsorted integer array a and b with same size, determine if a is an permutation of b with some solution better than sorting.
		 */
    	System.out.println("09---------------------------------------");   

		int[] pArray1 = { 1, 2, 3, 4, 5 };
		int[] pArray2 = { 3, 4, 2, 5, 1 };
		System.out.println("Permutation 2 arrays: "+ Permutation.isPermutation(pArray1, pArray2));
		
		
		/*
		 * Given a array of characters, reverse all the words in the array
		 */
    	System.out.println("10---------------------------------------");   

		char[] reverArray = "The quick brown fox jumped over lazy old dog.".toCharArray();
		System.out.println("Sample: ");
		for (char tmp : reverArray) {
			System.out.print(tmp);
		}

		System.out.println("\nResult: ");
		for (char tmp : ReverseWordByWord.reverseChars(reverArray)) {
			System.out.print(tmp);
		}
    }