We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fbf8da0 commit ff80e60Copy full SHA for ff80e60
src/hackerrank/implementation/migratoryBirds.ts
@@ -17,10 +17,10 @@ function migratoryBirds(arr: number[]): number {
17
for (const bird of arr) {
18
console.debug(`bird ${bird}`);
19
20
- if (!map[bird]) {
21
- map[bird] = 1;
22
- } else {
+ if (map[bird]) {
23
map[bird] += 1;
+ } else {
+ map[bird] = 1;
24
}
25
26
console.debug(`bird = ${bird} ~> map[bird] = ${map[bird]}`);
0 commit comments