본문 바로가기
알고리즘/Codewars

[Codewars] Exes and Ohs (7 kyu) / JavaScript

by fluss 2022. 11. 19.

https://www.codewars.com/kata/55908aad6620c066bc00002a

 

Codewars - Achieve mastery through coding practice and developer mentorship

A coding practice website for all programming levels – Join a community of over 3 million developers and improve your coding skills in over 55 programming languages!

www.codewars.com

 

DESCRIPTION:

Check to see if a string has the same amount of 'x's and 'o's. The method must return a boolean and be case insensitive. The string can contain any char.

 

Examples input/output:

XO("ooxx") => true
XO("xooxx") => false
XO("ooxXm") => true
XO("zpzpzpp") => true // when no 'x' and 'o' is present should return true
XO("zzoo") => false

 


설명:

문자열이 같은 수의 'x'와 'o'를 가지고 있는지 확인하세요. 메소드는 불리언은 반환하고 대소문자를 구분하지 않습니다. 문자열은 모든 문자를 포함할 수 있습니다.

 

예시 입력/출력:

XO("ooxx") => true
XO("xooxx") => false
XO("ooxXm") => true
XO("zpzpzpp") => true // when no 'x' and 'o' is present should return true
XO("zzoo") => false
 

댓글