Skip to content

Dana AlDulaijan & Raghad Alobaid#14

Open
rfo97 wants to merge 1 commit into
JoinCODED:mainfrom
rfo97:main
Open

Dana AlDulaijan & Raghad Alobaid#14
rfo97 wants to merge 1 commit into
JoinCODED:mainfrom
rfo97:main

Conversation

@rfo97
Copy link
Copy Markdown

@rfo97 rfo97 commented Mar 9, 2025

No description provided.

Comment thread src/functions.ts
}
n--;
}
return counter; // replace -1 with what you see is fit
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could have been solved without a loop ;)

function oddsSmallerThan(n: number): number {
  if (isOdd(n)) return (n + 1) / 2;
  return n / 2;
}

OR

function oddsSmallerThan(n: number): number {
  return (n + (isOdd(n) ? 1 : 0)) / 2;
}

Comment thread src/functions.ts
// Your code here

return -1; // replace -1 with what you see is fit
var result: number
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you keep using var instead of let and const

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants