File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 39
39
867|[ Transpose Matrix] ( ./0867-transpose-matrix.js ) |Easy|
40
40
890|[ Find and Replace Pattern] ( ./0890-find-and-replace-pattern.js ) |Medium|
41
41
916|[ Word Subsets] ( ./0916-word-subsets.js ) |Medium|
42
+ 925|[ Long Pressed Name] ( ./0925-long-pressed-name.js ) |Easy|
42
43
929|[ Unique Email Addresses] ( ./0929-unique-email-addresses.js ) |Easy|
43
44
966|[ Vowel Spellchecker] ( ./0966-vowel-spellchecker.js ) |Medium|
44
45
970|[ Powerful Integers] ( ./0970-powerful-integers.js ) |Easy|
Original file line number Diff line number Diff line change
1
+ /**
2
+ * 925. Long Pressed Name
3
+ * https://leetcode.com/problems/long-pressed-name/
4
+ * Difficulty: Easy
5
+ *
6
+ * Your friend is typing his name into a keyboard. Sometimes, when typing a character c,
7
+ * the key might get long pressed, and the character will be typed 1 or more times.
8
+ *
9
+ * You examine the typed characters of the keyboard. Return True if it is possible that
10
+ * it was your friends name, with some characters (possibly none) being long pressed.
11
+ */
12
+
13
+ /**
14
+ * @param {string } name
15
+ * @param {string } typed
16
+ * @return {boolean }
17
+ */
18
+ var isLongPressedName = function ( name , typed ) {
19
+ let i = 0 ;
20
+ return typed . split ( '' ) . filter ( l => name [ i ] === l ? ++ i : false ) . length === name . length ;
21
+ } ;
You can’t perform that action at this time.
0 commit comments