private int get3PowerK1(int size){
        int power = 1;
        while((power*3 +1)<= size){
            power = power*3;
        }
        return power+1;
    }
http://www.geeksforgeeks.org/an-in-place-algorithm-for-string-transformation/
src/com/interview/string/InPlaceTransformationOfString.java