You are viewing a single comment's thread. Return to all comments →
char arr[]=s.toCharArray(); List<Character> ch=new ArrayList<>(); for(char c: arr){ ch.add(c); } Map<Character,Long> map= ch.stream().collect(Collectors.groupingBy(Function.identity(),Collectors.counting())); Collection<Long> value= map.values(); if(value.stream().allMatch(e->e%2==0)){ return "YES"; }else if(value.stream().filter(e->e%2!=0).count()==1){ return "YES"; }else{ return "NO"; }
Seems like cookies are disabled on this browser, please enable them to open this website
Game of Thrones - I
You are viewing a single comment's thread. Return to all comments →
Java8