Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- java api
- react
- codewar
- codewars
- isSquare
- react hook
- JDBC
- TypeScript
- useEffect
- DB2
- custom hook
- type
- manifest.json
- TABLESPACE
- descendingOrder
- IBM
- Debug
Archives
- Today
- Total
taesik
Counting Duplicates 본문
Write a function that will return the count of distinct case-insensitive alphabetic characters and numeric digits that occur more than once in the input string. The input string can be assumed to contain only alphabets (both uppercase and lowercase) and numeric digits.
export function duplicateCount(text: string): number{
let array = text.toLowerCase().split('');
return [...new Set(array.filter((e,i) => array.indexOf(e) !== i))].length;
}
'functions and trick > typescript_javascript' 카테고리의 다른 글
check if two strings are ANAGRAM (using frequencyCounter) (0) | 2022.04.29 |
---|---|
retrun true if every value in the array has its corresponding value squared in the secone array. (0) | 2022.04.29 |
Backspaces in string (0) | 2022.01.29 |
Consecutive strings (0) | 2022.01.29 |
digitRoot (0) | 2022.01.29 |