classSolution{public String tictactoe(int[][] moves){int a =0, b =0, len = moves.length;int[] arr ={7,56,448,73,146,292,273,84};for(int i =0; i < len; i++){if((i &1)==1){
b ^=1<<(3* moves[i][0]+ moves[i][1]);}else{
a ^=1<<(3* moves[i][0]+ moves[i][1]);}}for(int i : arr){if((a & i)== i)return A;if((b & i)== i)return B;}return len ==9?"Draw":"Pending";}}
classSolution{publicbooleancontainsPattern(int[] arr,int m,int k){int len = arr.length;for(int i =0; i + m * k <= len; i++){boolean flag =true;for(int j = i; j < i + m * k; j++){if(arr[j]!= arr[i +(j - i)% m]){
flag =false;break;}}if(flag)returntrue;}returnfalse;}}