Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Classics #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
ashokdey merged 12 commits into master from classics
Sep 22, 2019
Merged

Classics #10

ashokdey merged 12 commits into master from classics
Sep 22, 2019

Conversation

Copy link
Member

@ashokdey ashokdey commented Sep 8, 2019

A new folder containing a few of the classic problems like:

  • Caesar Cipher
  • Fibonacci
  • Segmented Sieve
    .
    .
    .
    etc

@ashokdey ashokdey self-assigned this Sep 8, 2019
}

// determine the new index
const currentIndex = alphabets.indexOf(currentCharacter);
Copy link
Member

@TheSTL TheSTL Sep 8, 2019
edited
Loading

Choose a reason for hiding this comment

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

Try to use Map to find index of currentCharacter instead of indexOf.

  • With indexOf complexity will be O(n*26).
  • With Map complexity will be O(n).

Copy link
Member Author

@ashokdey ashokdey Sep 8, 2019

Choose a reason for hiding this comment

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

@TheSTL, any example snippet would be helpful.

Copy link
Member

@TheSTL TheSTL Sep 8, 2019
edited
Loading

Choose a reason for hiding this comment

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

ashokdey reacted with thumbs up emoji
Copy link
Member

@TheSTL TheSTL left a comment

Choose a reason for hiding this comment

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

Please remove these files, master branch contain updated files :

  • src/Problems/find-2-nums-adding-to-n/index.js
  • src/Problems/find-2nd-max/index.js

Copy link
Member

@TheSTL TheSTL left a comment

Choose a reason for hiding this comment

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

Please remove these files, master branch contain updated files :

  • src/Problems/find-2-nums-adding-to-n/index.js
  • src/Problems/find-2nd-max/index.js

Output: 0 // overflows
Note:
Assume we are dealing with an environment which could only
store integers within the 32-bit signed integer range: [−2^31, 2^31 − 1].
Copy link
Member

Choose a reason for hiding this comment

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

Try to solve problem for input > 2^31 -1 .
It is also possible.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it can be done, I tried that before adding the return 0; block. I simply posted the solution for one of the coding challenge platforms.

Copy link
Member Author

Please remove these files, master branch contain updated files :

  • src/Problems/find-2-nums-adding-to-n/index.js
  • src/Problems/find-2nd-max/index.js

Deleted the outdated files, then pulled from the master 👍

@ashokdey ashokdey merged commit 4ff441b into master Sep 22, 2019
@ashokdey ashokdey deleted the classics branch September 22, 2019 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@TheSTL TheSTL TheSTL approved these changes

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /