[java]  bruteforce + concise solution
`\n\njAVA BRUTE FORCE SOLUTION\n\n    public String decodeCiphertext(String str, int rows) {\n        \n        if(rows==1) return str;\n        int num=0;\n   
`\n\njAVA BRUTE FORCE SOLUTION\n\n    public String decodeCiphertext(String str, int rows) {\n        \n        if(rows==1) return str;\n        int num=0;\n        \n        int i=0,len=str.length();\n        int j=0;\n        int temp=len/rows+1;\n        if(len%rows!=0) temp++;\n        \n        char arr[][]=new char[rows][temp];\n        while(i<len){\n            int c=Math.min(temp,len-i);\n            if(c!=temp){\n                for(int k=0;k<c;k++){\n                    arr[j][k]=str.charAt(i+k);\n                }\n            }\n            else{\n                arr[j++]=str.substring(i,i+temp).toCharArray();\n            }\n            \n            i+=temp;\n        }\n        StringBuilder sb=new StringBuilder();\n        for(i=0;i<temp;i++){\n            for(j=0;j<rows;j++){\n                sb.append(arr[j][i]);\n            }\n        }\n        str=sb.toString();\n        i=str.length()-1;\n        while(i>=0 && (str.charAt(i)==\'\\u0000\' || str.charAt(i)==\' \')) i--;\n        return str.substring(0,i+1);\n    }\n\t\n\tAPPROACH 2\n\t  public String decodeCiphertext(String encodedText, int rows) {\n        int l = (encodedText.length() % rows == 0) ? encodedText.length()/rows : encodedText.length()/rows + 1;\n        StringBuilder sb = new StringBuilder();\n        for (int j = 0; j < l; j++) {     \n            for (int i = 0; i < rows; i++) {\n                if (i + j + i * l < encodedText.length())\n                    sb.append(encodedText.charAt(i + j + i * l));\n            }\n        }\n        return sb.toString().stripTrailing();\n    }\n
['Java']