/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package cf;

import java.util.Stack;

/**
 *
 * @author debmalyajash
 */
public class CodeFighter {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        System.out.println(sumOfThrees("4"));
        System.out.println(sumOfThrees("84"));
        System.out.println(sumOfThrees("531441"));
        System.out.println(sumOfThrees("2"));
        System.out.println(sumOfThrees("5"));
        
         for (int i = 1; i < 14; i++) {
            System.out.println(i + " gamma :" + gamma(i));
        }

    }

    public static String sumOfThrees(String n) {
        long m = Long.parseLong(n);
        int i = 0;
        StringBuilder sb = new StringBuilder();
        Stack<Integer> s = new Stack<>();

        while (m > 0) {

            long r = m % 3;
            if (r == 2) {
                return "Impossible";
            } else if (r != 0) {
                s.push(i);
            }
            i++;

            m /= 3;
        }

        while (!s.isEmpty()){
            sb.append(3).append("^").append(s.pop()).append("+");
        }
        return sb.toString().substring(0,sb.length()-1);

    }

    /**
     * This was a reverse challenge.
     * @param n - number of term.
     * @return value of the nth term.
     */
    public static int gamma(int n) {
        return (n == 1) ? 1 : (n - 1) * gamma(n - 1);
    }
}

@@ -1575,10 +1575,2062 @@
 ;%0A    %7D%0A
+    %0A    /**%0A     * Checking whether a Sudoku is correct or not.%0A     * @param s solved Sudoku.%0A     * @return true if it is correct, false otherwise.%0A     */%0A    public static boolean Sudoku(int%5B%5D%5B%5D s) %7B%0A        if (s.length == 9) %7B%0A            int%5B%5D sumb = new int%5B9%5D;%0A            for (int i = 0; i %3C s.length; i++) %7B%0A                int sum_h = 0;%0A                int sum_v = 0;%0A                for (int j = 0; j %3C s%5Bi%5D.length; j++) %7B%0A                    int v = s%5Bi%5D%5Bj%5D;%0A                    sum_h += v;%0A                    sum_v += s%5Bj%5D%5Bi%5D;%0A                    if (i %3E= 0 && i %3C= 2)%7B%0A                        if (j %3E= 0 && j %3C=2) %7B%0A                            sumb%5B0%5D += v;%0A                        %7Delse if (j %3E= 3 && j %3C=5) %7B%0A                            sumb%5B1%5D += v;%0A                        %7Delse if (j %3E= 6 && j %3C=8) %7B%0A                            sumb%5B2%5D += v;%0A                        %7D%0A                    %7D else if (i %3E= 3 && i %3C= 5)%7B%0A                        if (j %3E= 0 && j %3C=2) %7B%0A                            sumb%5B3%5D += v;%0A                        %7Delse if (j %3E= 3 && j %3C=5) %7B%0A                            sumb%5B4%5D += v;%0A                        %7Delse if (j %3E= 6 && j %3C=8) %7B%0A                            sumb%5B5%5D += v;%0A                        %7D%0A                    %7Delse if (i %3E= 6 && i %3C= 8)%7B%0A                        if (j %3E= 0 && j %3C=2) %7B%0A                            sumb%5B6%5D += v;%0A                        %7Delse if (j %3E= 3 && j %3C=5) %7B%0A                            sumb%5B7%5D += v;%0A                        %7Delse if (j %3E= 6 && j %3C=8) %7B%0A                            sumb%5B8%5D += v;%0A                        %7D%0A                    %7D%0A                    %0A                %7D%0A                if (sum_h != 45 %7C%7C sum_v != 45) %7B%0A                    return false;%0A                %7D%0A            %7D%0A            for (int i = 0; i %3C 9; i++) %7B%0A                if (sumb%5Bi%5D != 45)%7B%0A                    return false;%0A                %7D%0A                System.out.println(sumb%5Bi%5D);%0A            %7D%0A            return true;%0A        %7D else %7B%0A            return false;%0A        %7D%0A    %7D%0A
 %7D%0A

Update CodeFighter.java