You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+59Lines changed: 59 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -232,6 +232,65 @@ __Algorithmic Thinking:__ <p> From the challenge statement, we can infer that ou
232
232
233
233
__Code Implementation:__
234
234
235
+
We need to keep track of every character in the string as well as the number of times it exists.
236
+
237
+
The main concept we need here is character mapping. Our aim is to map characters to the number of times they exist.
238
+
239
+
for example: In string "success" <br>
240
+
* s=3
241
+
* u=1
242
+
* c=2
243
+
* e=1
244
+
245
+
*To implement this, an objet can be used.We loop through string received & add each character to a character map object as a key & the number of times it exists as a value*
246
+
247
+
```js
248
+
let charmap = {
249
+
s:3,
250
+
u:1,
251
+
c:2,
252
+
e:1
253
+
}
254
+
```
255
+
256
+
**Let's implement it**
257
+
258
+
```js
259
+
260
+
/*
261
+
maxCharValue is used to store the maximum value yet encountered at the point of every iteration with the for---in loop.
262
+
263
+
maxChar is used to store the character with the highest value on every iteration.
0 commit comments