harry528tt
BAN USERI can only find a way to calculate the length of the substring, can anyone help me to print out the string?
public class longestContinousSub{
int[][] longest= new int[3][3];
int[][] original= {{1,5,6},{2,8,7},{3,9,4}};
public int findLongestGoogle(int i,int j){
int max = 0;
if(longest[i][j]!=0) return longest[i][j];
//up
if(j>0 && original[i][j] == original[i][j-1]+1){
if(max < findLongestGoogle(i,j-1)){
max = findLongestGoogle(i,j-1);
}
}
//down
if(j<2 && original[i][j] == original[i][j+1]+1){
if(max < findLongestGoogle(i,j+1)){
max = findLongestGoogle(i,j+1);
}
}
//left
if(i>0 && original[i][j] == original[i-1][j]+1){
if(max < findLongestGoogle(i-1,j)){
max = findLongestGoogle(i-1,j);
}
}
//right
if(i<2 && original[i][j] == original[i+1][j]+1){
if(max < findLongestGoogle(i+1,j)){
max = findLongestGoogle(i+1,j);
}
}
longest[i][j] = max + 1;
return longest[i][j];
}
public static void main(String args[]){
longestContinousSub test = new longestContinousSub();
//int re = test.find();
int max = 0;
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
test.findLongestGoogle(i,j);
}
}
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
max = Math.max(max, test.longest[i][j]);
}
}
System.out.print(max);
}
}
I can only find a way to calculate the length of the substring, can anyone help me to print out the string?
public class longestContinousSub{
int[][] longest= new int[3][3];
int[][] original= {{1,5,6},{2,8,7},{3,9,4}};
public int findLongestGoogle(int i,int j){
int max = 0;
if(longest[i][j]!=0) return longest[i][j];
//up
if(j>0 && original[i][j] == original[i][j-1]+1){
if(max < findLongestGoogle(i,j-1)){
max = findLongestGoogle(i,j-1);
}
}
//down
if(j<2 && original[i][j] == original[i][j+1]+1){
if(max < findLongestGoogle(i,j+1)){
max = findLongestGoogle(i,j+1);
}
}
//left
if(i>0 && original[i][j] == original[i-1][j]+1){
if(max < findLongestGoogle(i-1,j)){
max = findLongestGoogle(i-1,j);
}
}
//right
if(i<2 && original[i][j] == original[i+1][j]+1){
if(max < findLongestGoogle(i+1,j)){
max = findLongestGoogle(i+1,j);
}
}
longest[i][j] = max + 1;
return longest[i][j];
}
public static void main(String args[]){
longestContinousSub test = new longestContinousSub();
//int re = test.find();
int max = 0;
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
test.findLongestGoogle(i,j);
}
}
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
max = Math.max(max, test.longest[i][j]);
}
}
System.out.print(max);
}
}
I can only find a way to calculate the length of the substring, can anyone help me to print out the string?
public class longestContinousSub{
int[][] longest= new int[3][3];
int[][] original= {{1,5,6},{2,8,7},{3,9,4}};
public int findLongestGoogle(int i,int j){
int max = 0;
if(longest[i][j]!=0) return longest[i][j];
//up
if(j>0 && original[i][j] == original[i][j-1]+1){
if(max < findLongestGoogle(i,j-1)){
max = findLongestGoogle(i,j-1);
}
}
//down
if(j<2 && original[i][j] == original[i][j+1]+1){
if(max < findLongestGoogle(i,j+1)){
max = findLongestGoogle(i,j+1);
}
}
//left
if(i>0 && original[i][j] == original[i-1][j]+1){
if(max < findLongestGoogle(i-1,j)){
max = findLongestGoogle(i-1,j);
}
}
//right
if(i<2 && original[i][j] == original[i+1][j]+1){
if(max < findLongestGoogle(i+1,j)){
max = findLongestGoogle(i+1,j);
}
}
longest[i][j] = max + 1;
return longest[i][j];
}
public static void main(String args[]){
longestContinousSub test = new longestContinousSub();
//int re = test.find();
int max = 0;
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
test.findLongestGoogle(i,j);
}
}
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
max = Math.max(max, test.longest[i][j]);
}
}
System.out.print(max);
}
}
I can only find a way to calculate the length of the substring, can anyone help me to print out the string?
public class longestContinousSub{
int[][] longest= new int[3][3];
int[][] original= {{1,5,6},{2,8,7},{3,9,4}};
public int findLongestGoogle(int i,int j){
int max = 0;
if(longest[i][j]!=0) return longest[i][j];
//up
if(j>0 && original[i][j] == original[i][j-1]+1){
if(max < findLongestGoogle(i,j-1)){
max = findLongestGoogle(i,j-1);
}
}
//down
if(j<2 && original[i][j] == original[i][j+1]+1){
if(max < findLongestGoogle(i,j+1)){
max = findLongestGoogle(i,j+1);
}
}
//left
if(i>0 && original[i][j] == original[i-1][j]+1){
if(max < findLongestGoogle(i-1,j)){
max = findLongestGoogle(i-1,j);
}
}
//right
if(i<2 && original[i][j] == original[i+1][j]+1){
if(max < findLongestGoogle(i+1,j)){
max = findLongestGoogle(i+1,j);
}
}
longest[i][j] = max + 1;
return longest[i][j];
}
public static void main(String args[]){
longestContinousSub test = new longestContinousSub();
//int re = test.find();
int max = 0;
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
test.findLongestGoogle(i,j);
}
}
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
max = Math.max(max, test.longest[i][j]);
}
}
System.out.print(max);
}
}
I can only find a way to calculate the length of the substring, can anyone help me to print out the string?
public class longestContinousSub{
int[][] longest= new int[3][3];
int[][] original= {{1,5,6},{2,8,7},{3,9,4}};
public int findLongestGoogle(int i,int j){
int max = 0;
if(longest[i][j]!=0) return longest[i][j];
//up
if(j>0 && original[i][j] == original[i][j-1]+1){
if(max < findLongestGoogle(i,j-1)){
max = findLongestGoogle(i,j-1);
}
}
//down
if(j<2 && original[i][j] == original[i][j+1]+1){
if(max < findLongestGoogle(i,j+1)){
max = findLongestGoogle(i,j+1);
}
}
//left
if(i>0 && original[i][j] == original[i-1][j]+1){
if(max < findLongestGoogle(i-1,j)){
max = findLongestGoogle(i-1,j);
}
}
//right
if(i<2 && original[i][j] == original[i+1][j]+1){
if(max < findLongestGoogle(i+1,j)){
max = findLongestGoogle(i+1,j);
}
}
longest[i][j] = max + 1;
return longest[i][j];
}
public static void main(String args[]){
longestContinousSub test = new longestContinousSub();
//int re = test.find();
int max = 0;
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
test.findLongestGoogle(i,j);
}
}
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
max = Math.max(max, test.longest[i][j]);
}
}
System.out.print(max);
}
}
I can only find a way to calculate the length of the substring, can anyone help me to print out the string?
public class longestContinousSub{
int[][] longest= new int[3][3];
int[][] original= {{1,5,6},{2,8,7},{3,9,4}};
public int findLongestGoogle(int i,int j){
int max = 0;
if(longest[i][j]!=0) return longest[i][j];
//up
if(j>0 && original[i][j] == original[i][j-1]+1){
if(max < findLongestGoogle(i,j-1)){
max = findLongestGoogle(i,j-1);
}
}
//down
if(j<2 && original[i][j] == original[i][j+1]+1){
if(max < findLongestGoogle(i,j+1)){
max = findLongestGoogle(i,j+1);
}
}
//left
if(i>0 && original[i][j] == original[i-1][j]+1){
if(max < findLongestGoogle(i-1,j)){
max = findLongestGoogle(i-1,j);
}
}
//right
if(i<2 && original[i][j] == original[i+1][j]+1){
if(max < findLongestGoogle(i+1,j)){
max = findLongestGoogle(i+1,j);
}
}
longest[i][j] = max + 1;
return longest[i][j];
}
public static void main(String args[]){
longestContinousSub test = new longestContinousSub();
//int re = test.find();
int max = 0;
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
test.findLongestGoogle(i,j);
}
}
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
max = Math.max(max, test.longest[i][j]);
}
}
System.out.print(max);
}
}
I can only find a way to calculate the length of the substring, can anyone help me to print out the string?
public class longestContinousSub{
int[][] longest= new int[3][3];
int[][] original= {{1,5,6},{2,8,7},{3,9,4}};
public int findLongestGoogle(int i,int j){
int max = 0;
if(longest[i][j]!=0) return longest[i][j];
//up
if(j>0 && original[i][j] == original[i][j-1]+1){
if(max < findLongestGoogle(i,j-1)){
max = findLongestGoogle(i,j-1);
}
}
//down
if(j<2 && original[i][j] == original[i][j+1]+1){
if(max < findLongestGoogle(i,j+1)){
max = findLongestGoogle(i,j+1);
}
}
//left
if(i>0 && original[i][j] == original[i-1][j]+1){
if(max < findLongestGoogle(i-1,j)){
max = findLongestGoogle(i-1,j);
}
}
//right
if(i<2 && original[i][j] == original[i+1][j]+1){
if(max < findLongestGoogle(i+1,j)){
max = findLongestGoogle(i+1,j);
}
}
longest[i][j] = max + 1;
return longest[i][j];
}
public static void main(String args[]){
longestContinousSub test = new longestContinousSub();
//int re = test.find();
int max = 0;
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
test.findLongestGoogle(i,j);
}
}
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
max = Math.max(max, test.longest[i][j]);
}
}
System.out.print(max);
}
}
I can only find a way to calculate the length of the substring, can anyone help me to print out the string?
public class longestContinousSub{
int[][] longest= new int[3][3];
int[][] original= {{1,5,6},{2,8,7},{3,9,4}};
public int findLongestGoogle(int i,int j){
int max = 0;
if(longest[i][j]!=0) return longest[i][j];
//up
if(j>0 && original[i][j] == original[i][j-1]+1){
if(max < findLongestGoogle(i,j-1)){
max = findLongestGoogle(i,j-1);
}
}
//down
if(j<2 && original[i][j] == original[i][j+1]+1){
if(max < findLongestGoogle(i,j+1)){
max = findLongestGoogle(i,j+1);
}
}
//left
if(i>0 && original[i][j] == original[i-1][j]+1){
if(max < findLongestGoogle(i-1,j)){
max = findLongestGoogle(i-1,j);
}
}
//right
if(i<2 && original[i][j] == original[i+1][j]+1){
if(max < findLongestGoogle(i+1,j)){
max = findLongestGoogle(i+1,j);
}
}
longest[i][j] = max + 1;
return longest[i][j];
}
public static void main(String args[]){
longestContinousSub test = new longestContinousSub();
//int re = test.find();
int max = 0;
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
test.findLongestGoogle(i,j);
}
}
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
max = Math.max(max, test.longest[i][j]);
}
}
System.out.print(max);
}
}
I can only find a way to calculate the length of the substring, can anyone help me to print out the string?
public class longestContinousSub{
int[][] longest= new int[3][3];
int[][] original= {{1,5,6},{2,8,7},{3,9,4}};
public int findLongestGoogle(int i,int j){
int max = 0;
if(longest[i][j]!=0) return longest[i][j];
//up
if(j>0 && original[i][j] == original[i][j-1]+1){
if(max < findLongestGoogle(i,j-1)){
max = findLongestGoogle(i,j-1);
}
}
//down
if(j<2 && original[i][j] == original[i][j+1]+1){
if(max < findLongestGoogle(i,j+1)){
max = findLongestGoogle(i,j+1);
}
}
//left
if(i>0 && original[i][j] == original[i-1][j]+1){
if(max < findLongestGoogle(i-1,j)){
max = findLongestGoogle(i-1,j);
}
}
//right
if(i<2 && original[i][j] == original[i+1][j]+1){
if(max < findLongestGoogle(i+1,j)){
max = findLongestGoogle(i+1,j);
}
}
longest[i][j] = max + 1;
return longest[i][j];
}
public static void main(String args[]){
longestContinousSub test = new longestContinousSub();
//int re = test.find();
int max = 0;
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
test.findLongestGoogle(i,j);
}
}
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
max = Math.max(max, test.longest[i][j]);
}
}
System.out.print(max);
}
}
I can only find a way to calculate the length of the substring, can anyone help me to print out the string?
public class longestContinousSub{
int[][] longest= new int[3][3];
int[][] original= {{1,5,6},{2,8,7},{3,9,4}};
public int findLongestGoogle(int i,int j){
int max = 0;
if(longest[i][j]!=0) return longest[i][j];
//up
if(j>0 && original[i][j] == original[i][j-1]+1){
if(max < findLongestGoogle(i,j-1)){
max = findLongestGoogle(i,j-1);
}
}
//down
if(j<2 && original[i][j] == original[i][j+1]+1){
if(max < findLongestGoogle(i,j+1)){
max = findLongestGoogle(i,j+1);
}
}
//left
if(i>0 && original[i][j] == original[i-1][j]+1){
if(max < findLongestGoogle(i-1,j)){
max = findLongestGoogle(i-1,j);
}
}
//right
if(i<2 && original[i][j] == original[i+1][j]+1){
if(max < findLongestGoogle(i+1,j)){
max = findLongestGoogle(i+1,j);
}
}
longest[i][j] = max + 1;
return longest[i][j];
}
public static void main(String args[]){
longestContinousSub test = new longestContinousSub();
//int re = test.find();
int max = 0;
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
test.findLongestGoogle(i,j);
}
}
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
max = Math.max(max, test.longest[i][j]);
}
}
System.out.print(max);
}
}
I can only find a way to calculate the length of the substring, can anyone help me to print out the string?
public class longestContinousSub{
int[][] longest= new int[3][3];
int[][] original= {{1,5,6},{2,8,7},{3,9,4}};
public int findLongestGoogle(int i,int j){
int max = 0;
if(longest[i][j]!=0) return longest[i][j];
//up
if(j>0 && original[i][j] == original[i][j-1]+1){
if(max < findLongestGoogle(i,j-1)){
max = findLongestGoogle(i,j-1);
}
}
//down
if(j<2 && original[i][j] == original[i][j+1]+1){
if(max < findLongestGoogle(i,j+1)){
max = findLongestGoogle(i,j+1);
}
}
//left
if(i>0 && original[i][j] == original[i-1][j]+1){
if(max < findLongestGoogle(i-1,j)){
max = findLongestGoogle(i-1,j);
}
}
//right
if(i<2 && original[i][j] == original[i+1][j]+1){
if(max < findLongestGoogle(i+1,j)){
max = findLongestGoogle(i+1,j);
}
}
longest[i][j] = max + 1;
return longest[i][j];
}
public static void main(String args[]){
longestContinousSub test = new longestContinousSub();
//int re = test.find();
int max = 0;
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
test.findLongestGoogle(i,j);
}
}
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
max = Math.max(max, test.longest[i][j]);
}
}
System.out.print(max);
}
}
I can only find a way to calculate the length of the substring, can anyone help me to print out the string?
public class longestContinousSub{
int[][] longest= new int[3][3];
int[][] original= {{1,5,6},{2,8,7},{3,9,4}};
public int findLongestGoogle(int i,int j){
int max = 0;
if(longest[i][j]!=0) return longest[i][j];
//up
if(j>0 && original[i][j] == original[i][j-1]+1){
if(max < findLongestGoogle(i,j-1)){
max = findLongestGoogle(i,j-1);
}
}
//down
if(j<2 && original[i][j] == original[i][j+1]+1){
if(max < findLongestGoogle(i,j+1)){
max = findLongestGoogle(i,j+1);
}
}
//left
if(i>0 && original[i][j] == original[i-1][j]+1){
if(max < findLongestGoogle(i-1,j)){
max = findLongestGoogle(i-1,j);
}
}
//right
if(i<2 && original[i][j] == original[i+1][j]+1){
if(max < findLongestGoogle(i+1,j)){
max = findLongestGoogle(i+1,j);
}
}
longest[i][j] = max + 1;
return longest[i][j];
}
public static void main(String args[]){
longestContinousSub test = new longestContinousSub();
//int re = test.find();
int max = 0;
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
test.findLongestGoogle(i,j);
}
}
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
max = Math.max(max, test.longest[i][j]);
}
}
System.out.print(max);
}
}
I can only find a way to calculate the length of the substring, can anyone help me to print out the string?
public class longestContinousSubInMatrix_Ski {
int[][] longest= new int[3][3];
int[][] original= {{1,5,6},{2,8,7},{3,9,4}};
public int findLongestGoogle(int i,int j){
int max = 0;
if(longest[i][j]!=0) return longest[i][j];
//up
if(j>0 && original[i][j] == original[i][j-1]+1){
if(max < findLongestGoogle(i,j-1)){
max = findLongestGoogle(i,j-1);
}
}
//down
if(j<2 && original[i][j] == original[i][j+1]+1){
if(max < findLongestGoogle(i,j+1)){
max = findLongestGoogle(i,j+1);
}
}
//left
if(i>0 && original[i][j] == original[i-1][j]+1){
if(max < findLongestGoogle(i-1,j)){
max = findLongestGoogle(i-1,j);
}
}
//right
if(i<2 && original[i][j] == original[i+1][j]+1){
if(max < findLongestGoogle(i+1,j)){
max = findLongestGoogle(i+1,j);
}
}
longest[i][j] = max + 1;
return longest[i][j];
}
public static void main(String args[]){
longestContinousSubInMatrix_Ski test = new longestContinousSubInMatrix_Ski();
//int re = test.find();
int max = 0;
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
test.findLongestGoogle(i,j);
}
}
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
max = Math.max(max, test.longest[i][j]);
}
}
System.out.print(max);
}
}
how do you know that? and how did you get this "90%" number? by conforming each of these problems?
- harry528tt July 19, 2014