Skip to content

Commit 9c163f1

Browse files
committed
Update Letter Count I
1 parent f9d3bce commit 9c163f1

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

Letter Count I

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,19 @@
33
* CODERBYTE BEGINNER CHALLENGE *
44
* *
55
* Letter Count I *
6-
* Using the JavaScript language, have the function FirstFactorial(num) take the num *
7-
* parameter being passed and return the factorial of it (ie. if num = 4, *
8-
* return (4 * 3 * 2 * 1)). For the test cases, the range will be between 1 and 18. * *
6+
* Have the function LetterCountI(str) take the str parameter being passed and return *
7+
* the first word with the greatest number of repeated letters. For example: *
8+
* "Today, is the greatest day ever!" should return greatest because it has 2 e's *
9+
* (and 2 t's) and it comes before ever which also has 2 e's. If there are no words *
10+
* with repeating letters return <b>-1</b>. Words will be separated by spaces. *
11+
*
912
* *
1013
* SOLUTION *
11-
* You can either use an iterative or recursive function to solve this challenge. *
12-
* I am going to use an interative function. I am going to start with a value of 1 *
13-
* for my total and then keep multiplying it by the next number until I reach num. *
1414
* *
15-
* This function needs to account for a possible outlier - One and Zero. *
16-
* If num is 1 or 0 then the answer is 1. By setting tot to value of 1 at *
17-
* initialization, then it guaranteees that 1 will be returned if num is ever 0 or 1. *
1815
* Steps for solution *
19-
* 1) Set var tot to 1. *
20-
* 2) Loop from 2 to num and multiple tot by num to get new tot. *
21-
* 3) Return tot for answer. *
16+
* 1) *
17+
* 2) *
18+
* 3) *
2219
* *
2320
***************************************************************************************/
2421

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy