GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Java/Programs/Xorpalindrome.java at main · Koder-Sunil/Java Expand file tree/ Copy pathXorpalindrome.javaMore file actions 45 lines (42 loc) · 1 KB / Copy pathXorpalindrome.javaFile metadata and controls45 lines (42 loc) · 1 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 //code for xorpalindrome in Java import java.util.*; import java.lang.*; import java.io.*; class Xorpalindrome { public static void main (String[] args) throws java.lang.Exception { // your code goes here BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out)); int t=Integer.parseInt(br.readLine()); StringBuffer sb=new StringBuffer(); while(t-->0) { int n=Integer.parseInt(br.readLine()); String s=br.readLine(); int count1=0,count2=0; for(int i=0;i<s.length();i++) { if(s.charAt(i)=='1') count1++; else count2++; } boolean flag=false; if(n%2==0) { if(count1==count2||count1%2==0&&count2%2==0) flag=true; } else { flag=true; } if(flag) System.out.println("YES"); else System.out.println("NO"); } } } |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |