class Solution {
public long subarrayXor( int arr[ ] , int k) {
int n = arr.length ;
HashMap
< Integer ,Integer
> f
= new HashMap
<> ( ) ;
int [ ] prefixxor = new int [ n] ;
prefixxor[ 0 ] = arr[ 0 ] ;
for ( int i= 1 ; i< n; i++ ) {
prefixxor[ i] = prefixxor[ i- 1 ] ^ arr[ i] ;
}
f.put ( 0 ,1 ) ;
long count= 0 ;
for ( int i= 0 ; i< n; i++ ) {
if ( f.containsKey ( prefixxor[ i] ^ k) ) {
count+= f.getOrDefault ( prefixxor[ i] ^ k,0 ) ;
}
f.put ( prefixxor[ i] ,f.getOrDefault ( prefixxor[ i] ,0 ) + 1 ) ;
}
return count;
}
}
Y2xhc3MgU29sdXRpb24gewogICAgcHVibGljIGxvbmcgc3ViYXJyYXlYb3IoaW50IGFycltdLCBpbnQgaykgewogICAgICAgIGludCBuID1hcnIubGVuZ3RoOwogICAgICAgIAogICAgICAgIEhhc2hNYXA8SW50ZWdlcixJbnRlZ2VyPmYgPSBuZXcgSGFzaE1hcDw+KCk7CiAgICAgICAgCiAgICAgICAgaW50W10gcHJlZml4eG9yID0gbmV3IGludFtuXTsKICAgICAgICAKICAgICAgICBwcmVmaXh4b3JbMF09YXJyWzBdOwogICAgICAgIGZvcihpbnQgaT0xO2k8bjtpKyspewogICAgICAgICAgICBwcmVmaXh4b3JbaV09cHJlZml4eG9yW2ktMV1eYXJyW2ldOwogICAgICAgIH0KICAgICAgICAKICAgICAgICBmLnB1dCgwLDEpOwogICAgICAgIGxvbmcgY291bnQ9MDsKICAgICAgICAKICAgICAgICBmb3IoaW50IGk9MDtpPG47aSsrKXsKICAgICAgICAgICAgaWYoZi5jb250YWluc0tleShwcmVmaXh4b3JbaV1eaykpewogICAgICAgICAgICAgICAgY291bnQrPWYuZ2V0T3JEZWZhdWx0KHByZWZpeHhvcltpXV5rLDApOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGYucHV0KHByZWZpeHhvcltpXSxmLmdldE9yRGVmYXVsdChwcmVmaXh4b3JbaV0sMCkrMSk7CiAgICAgICAgfQogICAgICAgIAogICAgICAgIHJldHVybiBjb3VudDsKICAgIH0KfQ==
compilation info
Main.java:5: error: cannot find symbol
HashMap<Integer,Integer>f = new HashMap<>();
^
symbol: class HashMap
location: class Solution
Main.java:5: error: cannot find symbol
HashMap<Integer,Integer>f = new HashMap<>();
^
symbol: class HashMap
location: class Solution
2 errors
stdout