Crossword Puzzle Solution - Java and C++
Crossword Puzzle Solution - Java and C++
Crossword Puzzle Solution - Java and C++
import java.util.;
this.row = r;
this.col = c;
<String> set)
if(puzzle[r][c] != '+')
return;
}
//printPuzzle(puzzle);
//System.out.println("____________________");
if(puzzle[row][col] == '-')
);
if(rSz > 1)
for(String s: set)
lStart, s))
// if(c != null)
if(c == null)
printPuzzle(puzzleCopy);
return;
else
l);
ow;
for(String s: set)
setCopy.remove(s);
// if(c != null)
if(c == null)
printPuzzle(puzzleCopy);
return;
//return false;
System.out.print(puzzle[r][c]);
System.out.println();
String s) {
puzzle[r][col] = s.charAt(row-r);
t col, String s) {
rAt(row-r))
return false;
return true;
col)
{
for(int c = 0; c< 10; c++)
return null;
, String s)
puzzle[row][c] = s.charAt(c-col);
nt col, String s)
t(c-col))
return false;
return true;
}
public static int getLeftStartCol(char[][] puzzle, int row, i
nt col)
col--;
return col+1;
col)
row++;
return row-1;
int count = 0;
count++;
row--;
return count;
}
int count = 0;
count++;
col++;
return count;
setCopy.addAll(set);
return setCopy;
puzzleCopy[r][c] = puzzle[r][c];
}
}
return puzzleCopy;
/* Enter your code here. Read input from STDIN. Print out
puzzle[r][c] = word.charAt(c);
for(String s: cities)
set.add(s);
completeThePuzzle(puzzle, set);
C++ Code
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
bool flag=false;
//cout<<endl;
cout<<a[i][j];
cout<<endl;
if(a[i][j]=='-')
return false;
return true;
}
void fill(char a[][10], string w[], int n, int used, int take
n[10])
if(flag == true)
return;
flag = true;
print(a);
if(a[i][j] == '-')
int h_depth=1;
int v_depth=1;
h_depth++;
v_depth++;
+')))
])
{
taken[k] = 1;
taken[k]=0;
while(h>=0)
a[i][j+h--] = '-';
break;
a[i][j+h] = w[k][h];
//cout<<"\nUsed h1"<<w[k]<<i<<j;
//print(a);
a[i][j+h] = '-';
taken[k] = 0;
j] == '+')))
])
{
taken[k] = 1;
taken[k]=0;
while(v>=0)
a[i+v--][j] = '-';
break;
a[i+v][j] = w[k][v];
//cout<<"\nUsed v1"<<w[k]<<i<<j;;
//print(a);
a[i+v][j] = '-';
taken[k] = 0;
}
}
!= '+')))
{
taken[k] = 1;
taken[k]=0;
while(v>0)
a[i+v--][j] = '-';
break;
a[i+v][j] = w[k][v+1];
//cout<<"\nUsed v2"<<w[k]<<i<<j;
//print(a);
a[i+v][j] = '-';
taken[k] = 0;
1] != '+')))
taken[k] = 1;
taken[k]=0;
while(h>0)
a[i][j+h--] = '-';
break;
a[i][j+h] = w[k][h+1];
//cout<<"\nUsed h2"<<w[k]<<i<<j;
//print(a);
a[i][j+h] = '-';
taken[k] = 0;
int main() {
char mat[10][10];
cin>>mat[i][j];
string s;
cin>>s;
string word[10];
int counter = 0;
int p=0;
flag = false;
if(s[i]==';')
counter++;
p=0;
else
word[counter] += s[i];
return 0;